-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
The question mark in the proxy example in the doc -P http://localhost:8080?
is causing issue
#645
Comments
-P http://localhost:8080?
is causing issue-P http://localhost:8080?
is causing issue
I think I had the same misunderstanding of that section in the README; As I thought it was explaining the use of the That section in the README tries to explain a clever 'workaround' for when you want to test a Single-Page-App which handles its own urls (like Angular/React/Vue can with their Router-components). The use-case you are looking for (similar to mine, I think), is to run your static front-end on http://loocalhost:80 and let all requests to To do that, you would be using 'just' the The |
@elwinschmitz is correct, that part of the docs is only a suggestion for a workaround for single-page apps, which http-server does not explicitly support (and won't). To use the proxy normally, you probably don't want the |
@elwinschmitz I have a SPA and i need this kind of setup to make my SPA work with http-server
however I also have a backend on 5150 and want to proxy /api to 5150.. Basically I want to use both the catch-all redirect for SPA but also a proxy to the backend to another port for anything request like /api/. I tried looking at the options in --proxy-options and couldn't figure out how to do this. You said you used the proxy to pass to your BE - I assume you weren't needing a catchall redirect for SPA on your FE? |
@rook2pawn I only use it for the 'fake' backend indeed. But I think you can run 2 instances of |
@elwinschmitz I was very happy with the solution i am using now and i posted it here. Essentially I set up a vanilla https server, and then proxy everything that's starts with |
Aha. That's sounds neat. |
Steps to reproduce the issue, if applicable. Include the actual command and output and/or stack trace.
I ran
http-server /data -p 80 -P http://localhost:8080?
as suggested in the doc. When I hit http://localhost/test, my downstream server (which listening on 8080) get/?/test
What did you expect to happen?
Maybe I don't understand the purpose of the
?
at the end. Removing the?
fix the issue. Is this a mistake in the doc or I missed anything?Tell us about your environment
The text was updated successfully, but these errors were encountered: