ReverseProxy: Send hostname upstream

Maxim Dounin mdounin at mdounin.ru
Sat Dec 17 12:53:17 UTC 2011


Hello!

On Fri, Dec 16, 2011 at 04:52:44PM -0500, fatzopilot wrote:

> Hi,
> 
> I guess it is rather simple, but I am more of a coder than of an admin
> so not an expert in configuring webservers. I'd like to proxy an akamai
> proxy which relies on the full hostname being passed (IP is not
> enough).
> 
> server {
>   listen 80;
>   server_name proxy.mydomain.com 
> ##  ssl on;
>   location / {
>    proxy_pass http://someServer.akamai.com:80;
>    proxy_set_header Host $host;
>    access_log  /var/log/nginx/upstream.log  upstream;
>   }
> }
> To debug, I configured an upstream log like described here:
> http://bethesignal.org/blog/2009/07/22/watching-nginx-upstreams-with-collectd/
> 
> It seems, nginx is resolving the upstream host's DNS-Address and uses
> the IP in all upstream requests (ommitting the hostname) which is not
> enough for the upstream host to answer correctly.
> 
> How to forward the upstream hostname (here: someServer.akamai.com) as
> well?

Just remove "proxy_set_header Host $host;" from your config.  

Maxim Dounin



More information about the nginx mailing list