To me the idea of sending my user to a 404 because they went to /foo
instead of /Foo
is just awful. But when you use Gatsby's createPages
function to create dynamic page URLs/routes, it seems to always build case-sensitive URLs/routes.
Is there any way to make Gatsby route /foo
to /Foo
when using createPages
(without literally creating routes for every possible casing combination)?
Gatsby generates static HTML that you then deploy to any web server. Therefore, resolving the URL is really up to the web server you deploy to.
Gatsby would generate e.g. public/mypage/index.html
and the web server will resolve the URL /mypage
to that page.
There is also routing happening on the client side, but the URLs generated on the client side must not be different from the ones on the server side. Otherwise you will get 404s when reloading or going directly to a URL not supported by the server.
You could configure a proxy or middleware on your web server to do URL rewrites, but you can't do it with Gatsby or your Gatsby-based code.