Pages redirect or remove pages.dev domain to custom domain

I have deployed a Cloudflare Pages nuxt site and added a custom domain. The custom domain I have protected with Cloudflare Access.

Cloudflare Access does not stop people accessing the default *.pages.dev domain

Is it possible to redirect the *.pages.dev domain to the custom domain or remove it ?

2 Likes

I have found a way to restrict access to {yourappp}.pages.dev subdomain.

By using https://dash.teams.cloudflare.com/ you can add two applications (Access → Applications):

  • {yourappp}.pages.dev (production)
  • *.{yourappp}.pages.dev (for preview deployments)

By leaving “subdomain” field empty, you can target production app. Then it’s only the matter of defining rules, who can access and how they authenticate.

4 Likes

How are you getting pages.dev to show up in the Access domain? All I see are my zones.

Try manually pasting your CF pages address. It worked for me and I think I saw and autocomple after pasting.

1 Like

Ah, you can paste in a hostname! Cool! Though it doesn’t seem to verify if I paste in a pages.dev subdomain I don’t have.

Yeah, it seems odd. But I hope they verify that you own pages which you add and set rules to :slight_smile:

1 Like