You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled upon an issue when porting a website for hosting on Cloudflare pages.
Based on your output directory format, e.g., if you have foo/index.html, your request will be served at /foo/, whereas if you have /foo.html, it'll be served at /foo.
Cloudflare pages then proceed to do 308 redirects for any non-trailing slash URL, which might (in my case for sure) not be intended.
I talked with @danielroe about this, and he asked me to raise this here, as it would probably need to be addressed in Nitro.
He also went on to give an idea for a workaround, which works out great! (:
exportdefaultdefineNuxtConfig({nitro: {hooks: {// In the case of Cloudflare Pages, non-trailing slash pages cause 308 redirects, these are caused by the output file structure. /foo/index.html > /foo.html'prerender:generate'(route){if(route.fileName){route.fileName=route.fileName.replace(/(\w+)\/index.html$/,'$1.html')}}}}}})
Additional information
Would you be willing to help implement this feature?
The text was updated successfully, but these errors were encountered:
Hello,
I stumbled upon an issue when porting a website for hosting on Cloudflare pages.
Based on your output directory format, e.g., if you have foo/index.html, your request will be served at /foo/, whereas if you have /foo.html, it'll be served at /foo.
Cloudflare pages then proceed to do 308 redirects for any non-trailing slash URL, which might (in my case for sure) not be intended.
I talked with @danielroe about this, and he asked me to raise this here, as it would probably need to be addressed in Nitro.
He also went on to give an idea for a workaround, which works out great! (:
Additional information
The text was updated successfully, but these errors were encountered: