Welcome! Log In Create A New Profile

Advanced

Re: Dynamic upstream proxy_pass

Makailol Charls
April 09, 2014 04:32AM
Hello!

You need to use resolver directive in Nginx.
Also you need to set DNS entries for your backend hostname.

Best regards,
Makailol


On Wed, Apr 9, 2014 at 1:49 PM, kay <nginx-forum@nginx.us> wrote:

> I'm trying to set upstream names by variables, but nginx recognizes
> variables as hostnames, not upstream names.
>
> For example:
> map $cookie_backend $proxy_host {
> default 'backend1';
> '1' 'backend2';
> }
> ... ... ...
> upstream backend1 {
> server backend123:8080;
> server backend124:8080;
> }
> ... ... ...
> upstream backend2 {
> server backend223:8080;
> server backend224:8080;
> }
> ... ... ...
> location / {
> proxy_pass http://$proxy_host;
> }
>
> nginx returns error message:
> 2014/04/09 14:19:51 [error] 1085#0: *1128620 backend1 could not be resolved
> (3: Host not found) while sending to client, client: 192.168.1.145, server:
> localhost, request: "GET / HTTP/1.1", host: "localhost"
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,249142,249142#msg-249142
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Dynamic upstream proxy_pass

kay April 09, 2014 04:19AM

Re: Dynamic upstream proxy_pass

Makailol Charls April 09, 2014 04:32AM

Re: Dynamic upstream proxy_pass

kay April 09, 2014 05:03AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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