gitlab-pages on subdomain of gitlab does not work

Summary

Pages listening on a subdomain of the main domain does not work

Steps to reproduce

set the following external URLs in /etc/gitlab/gitlab.rb

external_url 'http://gitlab.example.com'
pages_external_url "http://pages.gitlab-test.example.com"

reconfigure

What is the current bug behavior?

The request groupname.pages.gitlab.example.com/project is redirected to the gitlab frontend. This results in a 502 Bad Gateway from nginx.

What is the expected correct behavior?

the corresponding gitlab-pages page should be displayed

Possible fixes

fix the documentation, that pages on a subdomain of the main domain is not supported or fix the domain redirection to the most fitting server