I have a number of upstreams that I select from based on a set of headers, but am finding after the addition of https://github.com/GUI/nginx-upstream-dynamic-servers that my $destination
variable is being interpreted as a URL and not an upstream. Here's a snippet:
http {
upstream LegacyService {
server my.server.location.com:443 max_fails=0 resolve;
}
upstream NewService {
server myNew.server.location.com:443 weight=100 max_fails=0 resolve;
}
...
map $http_some_header $destination {
default LegacyService;
"~marker" NewService;
}
server {
listen localhost:8080;
# lots of the usual setup
location / {
proxy_pass https://$destination;
}
}
}
This configuration gets me a bunch of errors as now my destinations are interpreted as URLs instead of the names of upstreams:
2021/08/09 11:05:56 [error] 15326#0: *5761 no live upstreams while connecting to upstream, client: 10.1.1.5, RequestID: 6ef3b58fc95e07b083e6186df62ba15d, server: my.server.com, request: "POST / HTTP/1.1", upstream: "https://LegacyService/", host: "my.server.com"
I'd like to understand why this change is happening and see if there's anything that can be done. Am I misreading the error message?