3

So I have the following proxy_pass:

server {

listen server:443 ssl;
server_name test.test.com;

location /api/testapi/v1/users
    proxy_connection_timeout 120;
    proxy_pass https://api.test.com/testapi/v1/users
}

I've noticed that out of the blue, I'd get 503 or 504 timeouts on my service that I'm proxying to. I suspect it is because the IP address of api.test.com is being switched because I can restart my NGINX and everything is back to normal.

What's the proper way of having an either 0 TTL or some way to resolve everytime the proxy_pass is done because I wouldn't know if the IP changed.

I did notice you can do this:

resolver 10.0.0.2 valid=10s;

server {
    location / {
        set $backend_servers backends.example.com;
        proxy_pass http://$backend_servers:8080;
    }
}

However, will it work if I don't put a resolver in there? I just want to use whatever my default resolver is without specifying resolver.

0 Answers0