node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Forward proxy fails for some sites.

Open n-samir opened this issue 10 years ago • 1 comments

This works for some sites but for others, it does not. Basically, some of the URLs in the HTML pages give a 404 not found error when visited through the proxy but work fine otherwise. What am I missing here?

var httpApp  = require('express')(),
http               = require('http'),
httpProxy      = require('http-proxy');

httpServer = http.createServer(httpApp);
proxy = httpProxy.createProxyServer({xfwd:true,ws:true});

httpApp.use(function(req,res) {
proxy.web(req,res, {xfwd: true, ws:true, target:req.originalUrl }, function(err){console.log(err);});
});
httpServer.listen(5000);

Example, cnbc.com. Works fine, click on any link and its a 404 not found. Why?

n-samir avatar Dec 18 '15 20:12 n-samir

xfwd does not add the X-Forwarded-Host header (https://github.com/nodejitsu/node-http-proxy/issues/886)

Could that be the issue?

chimurai avatar Jan 15 '16 12:01 chimurai