Welcome! Log In Create A New Profile

Advanced

proxy_pass not passing to dynamic $host

October 31, 2013 07:55PM
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.
SubjectAuthorPosted

proxy_pass not passing to dynamic $host

nehay2jOctober 31, 2013 07:55PM

Re: proxy_pass not passing to dynamic $host

Francis DalyOctober 31, 2013 08:40PM

Re: proxy_pass not passing to dynamic $host

nehay2jOctober 31, 2013 09:39PM

Re: proxy_pass not passing to dynamic $host

Francis DalyNovember 01, 2013 01:54AM

Re: proxy_pass not passing to dynamic $host

nehay2jNovember 01, 2013 12:29PM

Re: proxy_pass not passing to dynamic $host

Francis DalyNovember 01, 2013 01:58PM

Re: proxy_pass not passing to dynamic $host

nehay2jNovember 01, 2013 05:16PM

Re: proxy_pass not passing to dynamic $host

nehay2jNovember 01, 2013 09:45PM

Re: proxy_pass not passing to dynamic $host

Francis DalyNovember 02, 2013 05:20AM

Re: proxy_pass not passing to dynamic $host

nehay2jNovember 02, 2013 10:21AM

Re: proxy_pass not passing to dynamic $host

Francis DalyNovember 02, 2013 12:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 64
Record Number of Users: 5 on December 17, 2014
Record Number of Guests: 154 on December 17, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready