stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Routing broken on page refresh #402

Closed rohan-deshpande closed 4 years ago

rohan-deshpande commented 4 years ago

Bug Report

react-snap@1.10.0

Current Behavior (Using react-router-4) When I navigate to a route other than /, for example, /about, and refresh the browser, the static site seems to mount components for / while also mounting things for the route component

Reproducible demo https://github.com/creativelifeform/nebula-web/tree/feature/react-snap

Expected behavior/code It should render the route and route component correctly

Possible Solution N/A

Additional context/Screenshots On navigate to route:

Screen Shot 2019-08-14 at 7 21 53 am

On refresh route:

Screen Shot 2019-08-14 at 7 22 02 am
stereobooster commented 4 years ago

how is your server configured?

rohan-deshpande commented 4 years ago

Happens locally using the default server suggested by CRA

stereobooster commented 4 years ago

the problem is in the server try this instead

npm run build
npx http-server -p 8000 build
rohan-deshpande commented 4 years ago

Interesting, do you have any idea what specific thing is causing this? Missing a trailing slash or something? It would be good to know whether I need to implement a specific nginx config in prod as I'm getting a similar issue there.

gvlatko commented 3 years ago

@rohan-deshpande did u figure out how to configure the server? this is happening also to me on aws s3 hosted site