Skip to content

Conversation

@jantimon
Copy link
Contributor

@jantimon jantimon commented Mar 4, 2015

This pull request implements the same feautre like #133 .
However it uses the http-proxy module instead of the proxy-middleware module.

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:

git clone https://github.com/jantimon/http-server.git --branch feature/node-http-proxy --single-branch --depth 1
cd http-server
npm install

Example usage

node bin/http-server -P http://blog.nodejitsu.com/

Open http://localhost:8080/img/ and it will resolve http-server/public/img just like before.

index_of__img_

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:

proxyexample

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 in http://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:8080

The proxy feature works even better if you disable the directory listening -d false but this is not required.

@jantimon jantimon mentioned this pull request Mar 4, 2015
@indexzero
Copy link
Member

Looks good. if the Travis build is OK then I'll merge this in 👍

indexzero added a commit that referenced this pull request Mar 4, 2015
Add --proxy setting (using http-proxy)
@indexzero indexzero merged commit 363d928 into http-party:master Mar 4, 2015
@jantimon
Copy link
Contributor Author

jantimon commented Mar 4, 2015

Cool 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

Successfully merging this pull request may close these issues.

2 participants