Welcome! Log In Create A New Profile

Advanced

Using HttpMapModule with proxy_pass got 502

January 23, 2013 06:16AM
Hi everyone,

My project needs to route http request to different host with different domain name. I deployed HttpMapModule and proxy_pass, and the related nginx.conf segment is following:

http {
map $http_host $backend_servers {
app.example.com localdomain1; #if changed to ip, it's ok
default localdomain2;
}

server {
listen 80;
server_name localhost;
location /{
proxy_pass http://$backend_servers;
}
.......
}

When I send the requet uri as http://app.example.com, the result is 502 error. But if I changed the maping value as IP address not domain name, it worked with no problem. And if I change the proxy_pass item directly to http://localdomain1, it also worked as normal.

Does the proxy_pass + http_map_module not refer to DNS look? or is there any other point wrong in the nginx.conf ?

Thanks for any suggestion.
SubjectAuthorPosted

Using HttpMapModule with proxy_pass got 502

amozzJanuary 23, 2013 06:16AM

Re: Using HttpMapModule with proxy_pass got 502

Maxim DouninJanuary 23, 2013 09:22AM

Re: Using HttpMapModule with proxy_pass got 502

amozzJanuary 24, 2013 02:05AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
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