stefanpenner/ember-cli — pull request #2615 by typeoneerror (2014-12-02 01:44:30+00:00)
Title: Adds changeOrigin flag to http-server proxy.

After some poking around in the `ProxyServerAddon` and adding back the `host` param as the third parameter in here:

app.use(function(req, res) {
return proxy.web(req, res);
});

I started poking around in node-http-proxy and found some earlier issues related to the "Host" header. http-proxy does not seem to change the Host header for outgoing requests, so you have to flag `changeOrigin` to make this happen.

I added changeOrigin and this immediately fixes my bugs. So, I'm not sure if this is the correct implementation (perhaps this should be an option sent to the proxy via cmd line or a ./server proxy), but I figured I'd push it so you can see where I am at. Hope it helps.

Again, this fixes my issues. Unsure if this will break everyone else's proxies! This is a bit outside of my node knowledge, which is minimal.

References:

* [Use changeOrigin for proxyRequest](https://github.com/nodejitsu/node-http-proxy/commit/cee3e2f590058aa049b2f0b463e50e96272039f3)
* [Original host not being passed through](https://github.com/nodejitsu/node-http-proxy/issues/621)
* [Host header comments](https://github.com/nodejitsu/node-http-proxy/issues/150#issuecomment-2702793)