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

✨ Configure base path via CLI option #175

Open
jd-solanki opened this issue Sep 20, 2022 · 2 comments
Open

✨ Configure base path via CLI option #175

jd-solanki opened this issue Sep 20, 2022 · 2 comments

Comments

@jd-solanki
Copy link

Hi πŸ‘‹πŸ»

I generally publish my static site under some base path (not directly in root domain). Every time I make a build I have to create a dummy dirs to recreate the subpath environment and serve the site from root to test the site.

Is it possible to provide a base path via CLI option (serve --base "/myapp/") so each file is served like it is in myapp dir.

Thanks.

@lericson
Copy link

lericson commented May 30, 2024

+1. I fiddled with this for an hour, only to realize that you cannot do this using just rewrites. You should be able to with path-to-regexp, but it seems that there is a replacement of * for (.*), the reason for which I do not understand.

Edit: I think it may be to allow minimatch to work as a fallback? It's all very strange.

@lericson
Copy link

It seems even if you specify /base/:path+, which does capture the subpath correctly, the rewritten URL will have its slashes escaped and so it will fail.

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

2 participants