Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

proxy_pass not passing to dynamic $host

$
0
0
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.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>