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?