Welcome! Log In Create A New Profile

Advanced

proxy_pass not passing to dynamic $host

Posted by nehay2j 
proxy_pass not passing to dynamic $host
October 31, 2013 07:15PM
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.
Re: proxy_pass not passing to dynamic $host
December 12, 2013 12:07PM
Bump, I would really like an answer to this too! Please :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready