Organization-level custom domain not working for internal repository pages

Hello there!

I’ve read the GitHub Pages custom domain docs and they state:

After you configure a custom domain for a user or organization site, the custom domain will replace the <user>.github.io or <organization>.github.io portion of the URL for any project sites owned by the account that do not have a custom domain configured. For example, if the custom domain for your user site is www.octocat.com , and you have a project site with no custom domain configured that is published from a repository called octo-project , the GitHub Pages site for that repository will be available at www.octocat.com/octo-project .

I have configured an organization-level custom domain by creating a repository with the name organization and by enabling pages and a custom domain custom-subdomain.organization.com for that.

Based on the documentation above I was expecting that from now on all pages that do not specify another custom domain would be found under custom-subdomain.organization.com/repository-name but that is not the case. Instead, I get 404 " The site configured at this address does not contain the requested file. "
What am I missing? Is there any way to enable a custom (sub)domain for an entire organization such that all pages would automatically use that domain as explained in the docs?

Repository-specific custom domains work as intended, but setting up a new one for each repository is not a feasible solution. Redirection from organization.github.io/repo-name also works but that too is not an acceptable solution since it redirects to the default (unusable) domain name that all private pages have (unless a repository-specific custom domain is set).

Hello and welcome here!

The behavior you are describing works as intended but only for public Pages sites.

For security reasons, private Pages sites (the ones with a random default hostname that enforce authentication + authorization on access) need to be isolated.