The DNS wildcard A record points to the secondary IP 1.1.1.2 where the pages daemon listens.
*.pages.example.com. 1800 IN A 1.1.1.2
The documentation is not very clear that this IP should be set when setting up pages with custom domains. Or something else is wrong because when I set it to the primary IP of the gitlab instance, nginx returns contents from gitlab instead of pages.