Welcome! Log In Create A New Profile

Advanced

Re: proxy_pass not passing to dynamic $host

November 01, 2013 09:45PM
Hi,

I did a curl on the url - curl -i https://example.com/23.23.234.234

HTTP/1.1 302 Found
Date: Sat, 02 Nov 2013 01:37:47 GMT
Location: https://marketplace.example.com/marketplace/marketplace/login
Server: nginx/1.4.2
Content-Length: 0
Connection: keep-alive

Which is correct. But when I submit post request through browser, I gives me a 404 with no error in logs. Should i be using rewrite command here or not? If I remove rewrite command, it give file not found error as it picks default root path always.

2013/11/01 20:35:08 [error] 17339#0: *11 open() "/opt/nginx/html/test/main.html" failed (2: No such file or directory
), client: 10.10.4.167, server:example.com, request: "GET /test/main.html HTTP/1.1", host: "example.com", referrer: http://example.com/test_console/test.html



location ~ /(?<ec2instance>[0-9].*) {
# alias http://$ec2instance:8080/test;
# try_files $uri;
rewrite $(.*)$ https://$http_host:8080/test break;
proxy_pass http://$ec2instance:8080/test;
proxy_read_timeout 300;
proxy_connect_timeout 300;
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;
}


Regards,
Neha
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: 81
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready