Production deploy based on yarn static:build static files #236
-
Hi, I'm trying to deploy the static site version in production, but it has the refresh page issue described in the stackoverflow thread in the link below. I've created the rewrite rule from Has anyone have success in making this static site deploy and have site refresh working? Problem description: https://stackoverflow.com/questions/27928372/react-router-urls-dont-work-when-refreshing-or-writing-manually P.S. I have tried some of the suggestion from stackoverflow, without success. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Where did you configure the rewrite from If you are using some kind of apache server to statically deploy your app, you should add a file You should have something like the following:
Then this configuration file will be available in the apache server, and the rewriting will be done correctly. |
Beta Was this translation helpful? Give feedback.
-
Hi, @Rileran. After trying with a local apache server, I discovered that in the .htaccess example I should be using index.html instead of app.html, like below: The On render.com I just used the rewrite configuration below: Source: /app/* Everything is working as expected. Thanks |
Beta Was this translation helpful? Give feedback.
Hi, @Rileran. After trying with a local apache server, I discovered that in the .htaccess example I should be using index.html instead of app.html, like below:
RewriteRule "^app/" "index.html" [QSA,L]
The
yarn static:build
won't generate any app.html file and Apache was rewriting the url to nowhere. Just fixed the file name and it worked as expected on Apache.On render.com I just used the rewrite configuration below:
Source: /app/*
Destination: /index.html
Everything is working as expected.
Thanks