proxy_pass not passing to dynamic $host

nehay2j nginx-forum at nginx.us
Sat Nov 2 01:45:18 UTC 2013


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

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



More information about the nginx mailing list