http-party / node-http-proxy

A full-featured http proxy for node.js
https://github.com/http-party/node-http-proxy
Other
13.87k stars 1.96k forks source link

Original host not being passed through #621

Open suedama1756 opened 10 years ago

suedama1756 commented 10 years ago

When passing a request through the proxy via proxy.web() the original "source" host header is copied into the proxyReq. This is incorrect behavior.

For reference: http://www.mnot.net/blog/2011/07/11/what_proxies_must_do

edwardfung123 commented 10 years ago

I encountered to the same problem. some websites does not work without setting the right host. For example, Google appspot.

The options.headers is somewhat not documented. (took me hours to figure out how to achieve this without changing the source ode.)

in common.js setupOutgoing()

if (options.headers){
    extend(outgoing.headers, options.headers);
  }

So my fix is:

proxy.web(req, res, {
    headers : { 
      host : 'sth.appspot.com'
    }   
    , target: 'http://sth.appspot.com'
});
mhart commented 9 years ago

I just ran into this too. Deleting req.headers.host worked in my case too.

dyingjedi commented 9 years ago

Would this node-http-proxy work on a hosted and shared Google drive just like you can host websites from GD nowadays?

Thanks for any input! This may be what I'm looking for.

Please see this as examples

http://youtu.be/BTen-UipDys

or

http://youtu.be/mckYn7kd4YA

Thanks guys Hi5

also I guess I should fork my own to be able to tweak etc..