Nginx – Will nginx route no traffic to an upstream host with weight 0


I would like to temporarily route no traffic to a host in an nginx upstream. Rather than commenting it out, as this means nginx would be completely programmatically unaware of it, I was wondering whether setting its weight to zero would have the same effect (routing no traffic to the host). This is unclear from the documentation here

Will nginx honor weight=0?

Best Answer

From a (fairly cursory) reading of ngx_http_upstream_get_peer it seems nginx will pick a weight=0 server if there is nothing else to pick at all.

Specifically see

Related Topic