duplicate upstream server marked as down
Anton Yuzhaninov
citrin at citrin.ru
Tue Oct 10 02:45:28 UTC 2017
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/;
}
}
More information about the nginx
mailing list