serve icon indicating copy to clipboard operation
serve copied to clipboard

react app route problem

Open AliElkishawi opened this issue 1 year ago • 3 comments

when I used the serve to deploy my react app it was worked but when I insert my own route in browser its giving me a blank page " white screen " if go to my.domain.com/first_route ---> its worked but go to my.domain.com/first_route/second_route ---> giving me a blank screen

and thanks alot

AliElkishawi avatar Sep 09 '24 08:09 AliElkishawi

Not sure if this was already resolved, but for serving SPAs, you just have to add the -s option. According to the documentation: -s, --single Rewrite all not-found requests to index.html``

With that flag you shouldn't have issues.

JGuillenY avatar Nov 27 '24 03:11 JGuillenY

The solution for worked great for me. I say this issue can be closed. Perhaps put this in readme file? Serving SPAs are common.

ericlau-solid avatar Jan 10 '25 03:01 ericlau-solid

Something is weird with the -s flag it will not serve a html file named other.html in the root directory. Instead it serves index.html. It should only be rewriting not found requests.

esetnik avatar Feb 20 '25 18:02 esetnik