Change the way gatsby builds pages in src/pages
that are named with .html
at the end
#30459
Unanswered
cristianCeamatuAssist
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
I am working on a Gatsby project for a client that has SEO as a top priority, the project is being deployed to Cloudflare using workers. 90% of the old website pages URL's are ending in
.html
, ex:enterprise.html
,contact-us.html
, the client needs to keep these URL's due to SEO purposes so we created the gatsby pages with the same names:enterprise.html.js
,contact-us.html.js
which Gatsby bundles topublic/enterprise.html/index.html
andpublic/contact-us.html/index.html
. Everything worked perfectly on our staging environment until we deployed to project to Cloudflare where we getting404
on all pages ending with.html
. I investigated and found out that Cloudflare workers (consider them a .htaccess version of Apache written in Javascript) use a function calledmapRequestToAsset
that decides if adding/
or/index.html
to URL's in order to find the resources on the server. The function from the official repo:Link to the github repo of Cloudflare's - kv-asset-handler
The problem is that
mime.getType(pathname)
used onenterprise.html
orcontact-us.html
link returnstrue
and the worker does not add/
or/index.html
and does not find the resource causing the404's
.My question: is there any config in Gatsby where I can choose to bundle
enterprise.html.js
toenterprise.html
without adding the extra folder name andindex.html
file? That would help alot.Beta Was this translation helpful? Give feedback.
All reactions