proxy_pass not passing to dynamic $host

nehay2j nginx-forum at nginx.us
Fri Nov 1 21:16:11 UTC 2013


Thanks Francis. I could finally see the post parameters at server end.
Setting proxy_set_header Host $1; changes the browser url which we donot
want. Currently, the code looks like-

        location ~ /(?<ec2instance>[0-9].*) {
                rewrite  $(.*)$ https://$http_host/test last;
                proxy_pass http://$ec2instance:8080/test;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;

}

If i set 'proxy_set_header Host $http_host;'  to have $proxy_host instead of
$http_host, all other things work fine other than cookies. Cookies does not
get transferred. Having $http_host throws 404 error with the following entry
in log-

2013/11/01 21:05:37 [error] 17515#0: *1 open() "/opt/nginx/html/test" failed
(2: No such file or directory), client:
10.10.4.167, server: example.com, request: "GET /testHTTP/1.1", host:
"example.com
", referrer: "http://example.com/test/test.html"

I will try to get the tcpdump of traffic.


Regards,
Neha

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,244308,244361#msg-244361



More information about the nginx mailing list