The question mark in the proxy example in the doc `-P http://localhost:8080?` is causing issue
See original GitHub issueSteps 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
- exact http-server version: 0.12.3
- Node version: 12.18.3
- Platform: Windows 10
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
problem in apache httpd.conf with question mark character
From the documentation for ProxyPass: url is a partial URL for the remote server and cannot include a query string. In your example,...
Read more >Is the Proxy Setting Causing a Problem? - Oracle Help Center
Solution. A server instance running on localhost might not be accessible if the server host machine is connected to the web through a...
Read more >Networking Guide Red Hat Enterprise Linux 7
The Red Hat Enterprise Linux 7 Networking Guide documents relevant information regarding the configuration and administration of network interfaces, ...
Read more >How to Make Secure HTTP Requests with Vue and Express
This is where you'll fill out some important information that allows the Auth0 application to connect to your Vue application. Fill these out...
Read more >Apache 2.4 + PHP-FPM + ProxyPassMatch - Server Fault
I ran into this problem yesterday as well – Apache 2.4 moved out of ... In your fpm pool configuration, don't pass the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I had the same misunderstanding of that section in the README; As I thought it was explaining the use of the
--proxy
-option, but actually it isn’t. (See the discussion: https://github.com/http-party/http-server/issues/338#issuecomment-338601211)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
/api/
for example, go to http://back-end.example.com/api/ (or locally to http://localhost:8080/api/)To do that, you would be using ‘just’ the
--proxy
-option:npx http-server --port 80 --proxy http://back-end.example.com/
The
?
in the URL in the README is only there to ‘pass’ the rest of the URL to your localindex.html
and let your framework’s Router handle it.is the basic setup that i use - what’s nice about this approach is that you have a clean separation between your SPA and your BE (repo, hosting/instances) and you can even put all sorts of things at your proxy level (administrative redirects, prevent spam attacks) so your logic on your SPA/BE/proxy are all cleanly split into the domains they are best suited for. i setup a small repo that ties this all together but you can do this setup on any framework you want.