13 messages in ru.sysoev.nginxRe: proxy pass
FromSent OnAttachments
Igor SysoevNov 28, 2007 11:17 am 
Eire AngelNov 28, 2007 4:55 pm 
Igor SysoevNov 28, 2007 10:22 pm 
Cliff WellsNov 29, 2007 10:48 am 
Igor SysoevNov 29, 2007 11:05 am 
Cliff WellsNov 29, 2007 11:39 am 
Cliff WellsNov 29, 2007 6:41 pm 
Igor SysoevNov 29, 2007 10:50 pm 
Igor SysoevNov 29, 2007 10:53 pm 
Igor SysoevNov 30, 2007 12:25 am 
Igor SysoevNov 30, 2007 6:46 am 
Cliff WellsNov 30, 2007 2:11 pm 
Igor SysoevNov 30, 2007 2:20 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: proxy passActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Nov 29, 2007 11:05:58 am
List:ru.sysoev.nginx

On Thu, Nov 29, 2007 at 10:49:09AM -0800, Cliff Wells wrote:

On Thu, 2007-11-29 at 09:22 +0300, Igor Sysoev wrote:

On Wed, Nov 28, 2007 at 04:55:25PM -0800, Eire Angel wrote:

The proxy_pass supports variables, for example:

proxy_pass http://$host$uri;

and the the host part will be resolved on the fly.

Upgraded to Nginx 0.6.20.

I tried once again to use:

http { map $host $backend { hostnames; .cellarstella.com 127.0.0.6:8000; }

server { server_name cellarstella.com www.cellarstella.com;

location / { # proxy_pass http://127.0.0.6:8000; # this works proxy_pass http://$backend; include /etc/nginx/proxy.conf; } }

}

But I get this in the error log:

2007/11/29 10:35:52 [error] 2698#0: *28 no resolver defined to resolve
127.0.0.6, client: 67.189.89.59, server: www.cellarstella.com, request: "GET /
HTTP/1.1", host: "www.cellarstella.com"

Is "map" not yet supported for proxy_pass or am I just doing it wrong?

First, you need add URI-part:

- proxy_pass http://$backend; + proxy_pass http://$backend$request_uri;

Second, after proxy_pass has parsed string it tries to resolve a host in following order:

1) search all described upstreams, 2) try external resolver (named/bind/etc); you should define it in http, server, or location section:

resolver 127.0.0.1;

however, if the host is an ip address, then nginx does not send DNS query to the resolver, but use the ip address.