Skip to content
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

-s option ignore existing file #125

Open
ambroiseRabier opened this issue Jul 19, 2020 · 3 comments
Open

-s option ignore existing file #125

ambroiseRabier opened this issue Jul 19, 2020 · 3 comments

Comments

@ambroiseRabier
Copy link

ambroiseRabier commented Jul 19, 2020

Files:

  1. build/index.html
  2. build/subdir/index.html

With serve -s build:

  • 1 work as expected. localhost:5000
  • 2 is being ignored, localhost:5000/subdir and localhost: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".

@buhichan
Copy link

buhichan commented Feb 22, 2021

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
}

@warren-bank
Copy link

shameless self-promotion alert:
this feature is fixed in my @warren-bank/serve fork of serve

@JenLyndle
Copy link

@buhichan where do I place the serve.json.
Screenshot 2024-03-06 at 11 24 14 AM
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants