proxy_pass not passing to dynamic $host

nehay2j nginx-forum at nginx.us
Thu Oct 31 23:55:15 UTC 2013


Hi,

I need to do proxy_pass to host name passed in url and rewrite url as well.
Since the host name is difference with each request, I cannot provide an
upstream for it. Below is the nginx configuration I am using but it doesnt
do proxy pass and returns 404 error. The hostname resembles ec2...com.

location ~* ^(/ec2..*)$ {
# try_files $uri $uri/index.html;
# rewrite ^(/ec2..*)$ https://example.com:8080/test last;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$1:8080/test;

}


Thanks.

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



More information about the nginx mailing list