-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPA with react + react-router #77
Comments
Yes, I've managed to get this working but it takes a few steps. First, remove the .html suffix from all files except index.html
However this will cause the content-type to be wrong in S3 so you have to specify defaultContentType serverless.yml
Now you'll have an issue where your js and css files are type html, so you have to separate those out first. In my case I'm exporting a next.js static site so this is in the
Then sync that one separately without the defaultContentType. Your Serverless.yml may look like this
Here's all the steps together in a gitlabCI file
|
@ipatka thanks but I believe the nextjs static generation is similar to gatsby where its generating static html files. I am doing a very straight forward old school react SPA where there is only 1 html file. no html files are generated. so I am afraid your method won't work for me. Thank you tho! |
Is there a way to configure this for use with a Single Page Application. Currently using react-router and if you refresh a route or link to a route other than root it sends the page as a 404. It appears to work for the user because ErrorDocument also points to index.html, however if you open up the console you can see it is serving it as a 404 page
The text was updated successfully, but these errors were encountered: