2021年4月1日星期四

Gatsby public folder structure doesn't play nicely with S3 static website hosting

So, let's say I have a simple Gatsby website with no backend, just plain text with two pages, index and about-us

Now when I run gatsby build, the public folder structure is something like this:

├── index.html  ├── about-us  │   ├── index.html  

Problem is, this kind of structure does not play nicely with S3, if I make a request to mywebsite.com/about-us, it will actually return a 404. S3 with static hosting enabled does not automatically route to mywebsite.com/about-us/index.html, although if I manually browse to that page it would work, but having my routes like that is a nightmare.

Question is, is there some configuration in Gatsby to make it not generate subfolders like this? And instead just create a about-us.html in the root folder?

So, I want to achieve the following :

├── index.html  ├── about-us.html  
https://stackoverflow.com/questions/66913640/gatsby-public-folder-structure-doesnt-play-nicely-with-s3-static-website-hostin April 02, 2021 at 10:08AM

没有评论:

发表评论