Maxim Dounin
September 23, 2016 03:00PM
Hello!

On Fri, Sep 23, 2016 at 11:38:44AM -0500, Philip Walenta wrote:

[...]

> I see an error of:
>
> *51 no resolver defined to resolve origin.9999, client: 5.6.7.8, server:
> www.example.com, request: "GET /api/v1/proxy/?tid=9999 HTTP/1.1", host: "
> www.example.com" - as if it only considers a DNS lookup, even though there
> is an upstream server block configured.

[...]

> Is there a reason the first example isn't working?
>
> It's very valuable to me to be able to pass the port to the upstream server
> as shown in the second example as it reduces the number of upstream blocks
> I need by a factor of 10 or more.

When using upstream groups as defined using the upstream{}
directive, ports are specified on per-server basis in the "server"
directives of the upstream group. If there is no port explicitly
specified, it just means that port 80 will be used by default.

If you'll try something like this, without variables:

upstream u {
server 127.0.0.1;
}

proxy_pass http://u:8080;

then nginx will complain right during configuration parsing:

nginx: [emerg] upstream "u" may not have port 8081 in ...

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

upstream and proxy_pass behavior

Philip Walenta September 23, 2016 12:40PM

Re: upstream and proxy_pass behavior

Maxim Dounin September 23, 2016 03:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready