serve-handler
serve-handler copied to clipboard
-s option ignore existing file
Files:
-
build/index.html
-
build/subdir/index.html
With serve -s build
:
- 1 work as expected.
localhost:5000
- 2 is being ignored,
localhost:5000/subdir
andlocalhost:5000/subdir/index.html
give 404 or redirect to root (don't remember which one).
With server build
:
- 1 work as expected.
localhost:5000
- 2 work as expected.
localhost:5000/subdir
I would have expected localhost:5000/subdir
with serve -s build
to server build/subdir/index.html
, and not build/index.html
(or 404) (I think it was redirect).
--help
show description:
-s, --single Rewrite all not-found requests to `index.html`
But current behavior seem to be "rewrite all requests to /index.html".
Also had this issue, it seems serve-handler by default redirect /build/subdir/index.html to /build/subdir, which is called 'cleanUrls' The temporary solution is to disable 'cleanUrls' by adding a serve.json:
{
"cleanUrls": false
}
shameless self-promotion alert:
this feature is fixed in my @warren-bank/serve
fork of serve
@buhichan where do I place the serve.json.
Am using serve to serve dist and the serve.json doesn't seem to work. The doc says to place the serve.json in public folder but am a bit confused about the placement. Any pointers will help, thanks!