Cloudflare pages generated a subdomain like example.pages.dev and i can also use a custom domain like example.com but when a custom domain is assigned why Cloudflare still make site accessible via .pages.dev url i do not want the wesbite to be accessible via .pages.dev after i have assigned a custom domain as both sites can show up on search engines why cant we just destroy to hide the .pages.dev or make it unaacessible after assigning a custom domain?
ok but instead of me applying hacks to each and every website hosted on Cloudflare pages why Cloudflare doesnt fix this. what is there purpose to keep showing .pages.dev when a custom domain is assigned and it is really not usefull to do when you have multiple website.
the only reason to host on Cloudflare pages is the ease of hosting but if i have to go and apply all the security headers and more advanced fixes then there is no ease of use and it make things more complicated.
does anyone know of any good reason why Cloudflare keep showing site on .pages.dev even after assigning a custom domain?
The pages.dev subdomains can be very useful for developing/previewing on new branches, etc. and _headers is designed for exactly this kind of thing, so I would not consider it a hack whatsoever.
But yes, a way to completely disable it would be useful I imagine, and I know this is something the team is considering for the future. I’d recommend joining the Cloudflare Developers Discord to stay up to date with all things Cloudflare Pages - lots of the team are active there and regularly share what they’re working on.
i am not comfortable with using headers files and the only reason to use Cloudflare/ Cloudflare pages is so i can easily manage the performance and security without having to deal with techy stuff. Cloudflare can easily make a button to open close developer url .pages.dev for a site instead me custom coding that i can simply click a button to activate or deactive development url while keeping my custom domain live site untouched and accessible at all times.
also there should be an easy security setup for Cloudflare pages since it is a Cloudflare tool and they know what it needs better than i do.
If it was that easy, we’d have done it already trust me haha. Sadly, it isn’t that simple. The _headers file is definitely easiest and @cherryjimbo gave the exact 2 lines you need. You don’t need to do more than that.
Siteground have the option called staging and when i click activate i make the staging url accessible, netlify does similar i dont know what happens in the background but me as a user all i have to do is click active on/off.
Not every one know that assigning custom domain still keeps the .pages.dev url still active i only find out today. also the Cloudflare seucrity could have been made easier for Cloudflare pages as it still ask questions like i am hosting the site somewhere else.
i beleive for your own product to increase the usuability and ease you can add a switch to auto apply fixes that you belive fits better to your product, just saying
thanks @cherryjimbo will try the header code and hopefully i will not make a mess
Appreciate the feedback. I agree that it would be a good option but I’m just saying, it isn’t a super easy job. Otherwise, it would be added already. Considering we have many alternatives (like _headers, _redirects, Page Rules, Bulk Redirects, Access and more) prioritising the work for this small feature over bigger features with more impact is hard. We’re still a pretty new product, we’ve been around for a year, Netlify has existed since 2014. Trust me, I love Quality of Life work and would love to implement this. It just isn’t something I can knock off in an hour.
It will be supported and we have will have an option in the future. For now, you can use one of the many other options which we have documented.
i mean make the .pages.dev url unaccessible or redirect to the custom domain as otherwise websites show up as duplicate on search engines unless someone write some custom rules. i beleive this should be the default value after adding custom domain. as many will never realize that the website is still accessible on the demo url or if is showing in search results as duplicate
Cloudflare acess is very dificult and confusing when i follow the instructions it block both .pages and custom domain behind password wall is there a more begginier friendly blog or tutorial with screenshots or video thanks
are there any easy solutions which works and can hide the pages.dev behind a login screen while not affecting the custom domain the current documentation is either outdated or the functionality is not working as expected
_redirects is text file how can i add the dynamic pages redirects any example wich will not break the custom domain can i add the below example will it work? is there some recomended method for Cloudflare pages pages.dev to custom domain redirect thanks