Welcome! Log In Create A New Profile

Advanced

Re: duplicate upstream server marked as down

Anton Yuzhaninov
October 09, 2017 10:46PM
On 10/03/17 14:00, halfpastjohn wrote:
> Can i have two, identical, server hostnames in an upstream, with one
of them
> marked as "down"? Like this:
>
> resolver 10.0.0.8;
>
> upstream backend {
> server backend.example.com down resolve;
> server backend.example.com/api/v2/;
> }

server in an upstream can contain only host:port for a server, not an URI.

> The reason being is that i need to route to the second one (with the
longer
> path), but i also need to resolve the hostname. Unfortunately it won't
> resolve when there is additional pathing tacked onto the end. So, i'm
hoping
> that this will allow the hostname to be resolved but only send traffic to
> the full path.

If you need to resolve server hostname in runtime, try this config:

resolver 10.0.0.8;

upstream backend {
zone z_backend 8k;
server backend.example.com resolve;
}

server {
location /foo/ {
proxy_pass http://backend/api/v2/;
}
}

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

duplicate upstream server marked as down

halfpastjohn October 03, 2017 02:00PM

Re: duplicate upstream server marked as down

Anton Yuzhaninov October 09, 2017 10:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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