1

I am trying to setup node-http-proxy. My goal is to put a proxy on my website. I could manually do this by doing the GETs on the server and then changing the links in the HTML but I would like to use an existing solution if there is one. Maybe I don't fully understand what node-http-proxy is. Here is my test code:

require("http-proxy").createServer(function (req, res, proxy) {
    proxy.proxyRequest(req, res, {
        host: 'npr.org',
        port: 80
    });
}).listen(8000);

I go to localhost:8000 and it returns NPR. But the source that is returned still includes links directly to NPR such as:

<script type="text/javascript" src="http://s.npr.org/templates/javascript/generated/fingerprint/homepageMetrics-62631a6b672420dab3673f851b6a5de98512e21d.js">

So if I were using the proxy to gain access to a website that is blocked it would not work. Nor would it work if I were using the proxy to keep the end server from knowing the client downloaded something. Basically the only HTTP proxying that is happening is with the initial GET (I think).

Is node-http-proxy capable of proxying all HTTP requests or is that something I will have to do manually?

user1873073
  • 3,580
  • 5
  • 46
  • 81
  • 1
    You can make your browser proxy all requests to your server by changing the proxy settings in your browser. http://superuser.com/a/31317 tells you how to do it for chrome – everconfusedGuy Jun 04 '13 at 06:59
  • I think I am starting to understand. Give me a few days to get around to try hooking this all up. I am thinking though, I could have two kinds of proxies. The first just host ASProxy as a quick/dirty on a subdomain that runs ASP.NET. The second would be a proper implementation of node-http-proxy. That sounds about right, right? – user1873073 Jun 04 '13 at 13:55

1 Answers1

1
sudo npm install npr -g

does the work, you may want to take a look at it.

abatishchev
  • 98,240
  • 88
  • 296
  • 433