Skip to content

Conversation

@jantimon
Copy link
Contributor

@jantimon jantimon commented Mar 3, 2015

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
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.

What do you think?

@indexzero
Copy link
Member

Would prefer if it used http-proxy: https://github.com/nodejitsu/node-http-proxy

@jantimon
Copy link
Contributor Author

jantimon commented Mar 4, 2015

Okay - I'll take a look at it

@jantimon
Copy link
Contributor Author

jantimon commented Mar 4, 2015

Closed because of #134

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