Add --proxy setting (using http-proxy) #134
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements the same feautre like #133 .
However it uses the
http-proxymodule instead of theproxy-middlewaremodule.From #133 :
This pull request would add a new feature to http-server.
It is called proxy as it uses the proxy-middleware module to redirect unresolvable requests to a given url.
Checkout the pull request:
Example usage
Open http://localhost:8080/img/ and it will resolve
http-server/public/imgjust like before.Next navigate to http://localhost:8080/nodejitsu-joins-godaddy/ - as it cannot find the folder
nodejitsu-joins-godaddy/locally it will redirect the requests to the proxy address and you will see the blog post:My motivation behind this pull request is debugging live pages
Lets say you have a web page running on
http://somepage.com/and there is a bug inhttp://somepage.com/example.js. All you have to do is placing a patched or debug version of example.js in a folder and start up http-server with a proxy to http://somepage.com and open http://localhost:8080The proxy feature works even better if you disable the directory listening
-d falsebut this is not required.