Problem with map+proxy_pass in 0.6.21

I’ve used the map+proxy_pass technique successfully elsewhere, so I
thought I’d try to use to to proxy to a bunch of OpenVZ virtual servers.

Each server is also running a copy of Nginx 0.5.x which in turns proxies
to various applications. So we have Nginx-0.6.1 -> Nginx-0.5.x -> app.

I tried with the following:

map $host $internal_ip {
hostnames;
101.develix.com 10.10.10.101;
102.develix.com 10.10.10.102;
103.develix.com 10.10.10.103;
# …
}

server {
listen 198.145.244.138;
server_name 107.develix.com;

access_log       /var/log/nginx/107.access_log main;
error_log        /var/log/nginx/107.error_log info;

location / {
    proxy_pass    http://$internal_ip:80$request_uri;
    include       /etc/nginx/proxy.conf;
}

}

The above causes a 500 internal server error with the following in the
log:
67.189.89.59 - - [15/Dec/2007:04:06:11 -0800] “GET / HTTP/1.1” 500 355
“-” “Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre)
Gecko/2007121304 Minefield/3.0b3pre” “-”

However if I replace the proxy_pass directive with

     proxy_pass    http://10.10.10.107:80;

and it works fine.

Any suggestions or does this look like a bug?

Regards,
Cliff

On Sat, Dec 15, 2007 at 11:12:49AM -0800, Cliff W. wrote:

101.develix.com  10.10.10.101;

The above causes a 500 internal server error with the following in the log:
Any suggestions or does this look like a bug?
What is in error_log ?

On Sat, 2007-12-15 at 22:17 +0300, Igor S. wrote:

On Sat, Dec 15, 2007 at 11:12:49AM -0800, Cliff W. wrote:

What is in error_log ?

Sorry, meant to paste that.

2007/12/15 04:24:11 [error] 4994#0: *2 invalid host in upstream “:80/”,
client: 67.189.89.59, server: veze.develix.com, request: “GET /
HTTP/1.1”, host: “veze.develix.com

Cliff

On Sat, Dec 15, 2007 at 11:22:59AM -0800, Cliff W. wrote:

On Sat, 2007-12-15 at 22:17 +0300, Igor S. wrote:

On Sat, Dec 15, 2007 at 11:12:49AM -0800, Cliff W. wrote:

What is in error_log ?

Sorry, meant to paste that.

2007/12/15 04:24:11 [error] 4994#0: *2 invalid host in upstream “:80/”, client: 67.189.89.59, server: veze.develix.com, request: “GET / HTTP/1.1”, host: “veze.develix.com

It seems you have no map entry for veze.develix.com.
You should set default entry.

On Sat, 2007-12-15 at 11:22 -0800, Cliff W. wrote:

On Sat, 2007-12-15 at 22:17 +0300, Igor S. wrote:

On Sat, Dec 15, 2007 at 11:12:49AM -0800, Cliff W. wrote:

What is in error_log ?

Sorry, meant to paste that.

2007/12/15 04:24:11 [error] 4994#0: *2 invalid host in upstream “:80/”, client: 67.189.89.59, server: veze.develix.com, request: “GET / HTTP/1.1”, host: “veze.develix.com

And to avoid confusion, veze.develix.com is an alias for
107.develix.com. I simplified my config for this email and cut that
part out.

Cliff

On Sat, Dec 15, 2007 at 11:26:02AM -0800, Cliff W. wrote:

And to avoid confusion, veze.develix.com is an alias for
107.develix.com. I simplified my config for this email and cut that
part out.

Do you have

103.develix.com   10.10.10.103;
veze.develix.com  10.10.10.103;

?

On Sat, Dec 15, 2007 at 11:31:46AM -0800, Cliff W. wrote:

On Sat, 2007-12-15 at 22:26 +0300, Igor S. wrote:

On Sat, Dec 15, 2007 at 11:22:59AM -0800, Cliff W. wrote:

2007/12/15 04:24:11 [error] 4994#0: *2 invalid host in upstream “:80/”, client: 67.189.89.59, server: veze.develix.com, request: “GET / HTTP/1.1”, host: “veze.develix.com

It seems you have no map entry for veze.develix.com.
You should set default entry.

Ugh. How did I miss that.

Sorry.

   map  ... {
       default     10.10.10.1;
       ...

On Sat, 2007-12-15 at 22:30 +0300, Igor S. wrote:

Do you have

103.develix.com   10.10.10.103;
veze.develix.com  10.10.10.103;

Yes, this is what I finally did after you pointed out my error.

Thanks,
Cliff

On Sat, 2007-12-15 at 22:26 +0300, Igor S. wrote:

On Sat, Dec 15, 2007 at 11:22:59AM -0800, Cliff W. wrote:

2007/12/15 04:24:11 [error] 4994#0: *2 invalid host in upstream “:80/”, client: 67.189.89.59, server: veze.develix.com, request: “GET / HTTP/1.1”, host: “veze.develix.com

It seems you have no map entry for veze.develix.com.
You should set default entry.

Ugh. How did I miss that.

Sorry.

Cliff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs