CDN gets 404 when using GiLab Pages as a source

I have a GitLab CE install set up with pages working.

When accessing the pages url directly e.g. https://account.domain.com/plain-html/ it works just fine.

However if I try add a CDN or even a basic reverse proxy e.g subdomain.domain.com and use the pages url as the source I get a 404.

I have tried KeyCDN, CloudFront and apache with the ProxyPass directive. I also disabled host forwarding in all cases. From what I can the requests are hitting the pages service as I can see entries in the log but the sites won’t load at all.