5 ms·
This sounds like a (critical) bug with Cloudflare Pages to me. No hosting provider should be fiddling with the url scheme, especially with permanent redirects.
by javajosh 3y ago
This sounds like a (critical) bug with Cloudflare Pages to me. No hosting provider should be fiddling with the url scheme, especially with permanent redirects. That's invasive and wrong. If it's an official policy or "feature" then someone at Cloudflare made a BIG mistake.
- the_mitsuhiko 3y agoCloudflare considers it a feature. There were discussions about this for quite a while but it never got changed as far as I can tell.
- r1ch 3y agoOne of the most unexpected and unwelcome features, like many others I only found out about this once my pages went live and users had cached the redirects.
- kqr 3y agoYeah, the permanent redirect is what really sounds weird to me. Those can be really invasive and should not be used lightly. I rarely use them these days because back when I did it was almost always a mistake.
- kentonv 3y agoIIRC, using a permanent redirect makes sure search engines treat the two URLs as pointing to the same page, accumulating all "page rank" to that one page, rather than treating it as two separate pages.
- zokier 3y agoIt is documented feature > Pages will also redirect HTML pages to their extension-less counterparts: for instance, /contact.html will be redirected to /contact, and /about/index.html will be redirected to /about/. https://developers.cloudflare.com/pages/configuration/serving-pages/#route-matching https://developers.cloudflare.com/pages/configuration/servin...
- antx 3y agoNowhere does it state that these are permanent, though.
- danpalmer 3y agoYeah this should definitely be opt-in. Cloudflare are infrastructure, and infrastructure should strongly prefer to be as neutral as possible on decisions that have the potential to break things.
- jopsen 3y agoHonestly, the author should read the docs. There are probably settings for this stuff. It's quite normal for static sites to do something weird here. Like having folders that all contain index.html, and then having settings to strip (or add) the final slash. There are so many different flavors, the only somewhat neutral default is what apache does.. still it's not much :)
- Stylishly 3y agoI mean looking at the docs, there is not anything that stands out as a configuration option for this. https://developers.cloudflare.com/pages/configuration/redirects/ https://developers.cloudflare.com/pages/configuration/redire... :)
- kentonv 3y agoMany hosting providers -- and many web servers, going back decades -- offer this functionality, because a lot of people want it. Keep in mind that this is Cloudflare Pages, not Cloudflare in general. Cloudflare Pages is a product where you give it a bunch of files, and it serves them as a web site. You don't have your own server behind Cloudflare in this case. Serving a web site based on a directory of files is tricky, because URL space and filesystem space are a little bit different. Files on disk need to have file extensions to indicate their type, but URLs are not supposed to have file extensions, because their type is indicated by the `Content-Type` header. So if you are taking a bunch of files and serving them as a site, you need to figure out how to transform the type info in the URLs into Content-Type headers in an appropriate way. This is a solution to that. Another remapping that nearly every file-based web server does is, if the URL turns out to be a directory, it returns a redirect to add `/` to the end, and then from there it serves the file called `index.html` in that directory. Again, this is needed because URL space and filesystem space don't exactly match: a directory on the filesystem cannot itself have byte content, it can only contain files. But a URL that is a directory can also directly serve content, so you have to figure out how to resolve that. `index.html` remapping is pretty much universally accepted. But it's true that people have differing opinions on extension-stripping. The extension is redundant, but some people would rather keep it just to make it clearer how URLs map to files. Fair enough. Unfortunately Cloudflare Pages does not have a setting for this right now. It has chosen to implement only the most popular approach. This is a product decision, and of course some people will disagree with it. You can submit a feature request, or you can use a different product that works the way you want (there are tons of them out there). But it's not a "bug" that the product has not chosen to implement your specific preferences. (Disclosure: I work for Cloudflare, but not specifically on Pages.)
- advisedwang 3y agoIt's common to serve /page with the contents of /page.html, but to issue permanent redirect is not.