NGINX Time Out Issue

Ngnix Time out issue

We have nginx config for routing to another domain for certain endpoints which through AWS Route 53 calls to load balancer.

The routing works fine but after few days we face time out issue until we restart nginx container, though we have added resolver still we see time out happen after certain days, Adding below config for reference :-

**
server {
listen 443 ssl;
server_name appl1.xyz.com;
resolver 169.254.169.253 valid=30s;

# Initial configuration that experienced timeouts
location ~ ^/(url1|url2)$ {

  

    proxy_pass https://appl2-prod.bytemark.co;
    proxy_set_header Host appl2-prod.bytemark.co;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location / {
           
            proxy_pass https://appl1-prod:9120;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    }

}

Note : proxy_pass https://appl2-prod.bytemark.co; this directly added as static content instead of using variable, IS it the reason resolver is not working.

**

We are using Nginx nginx/1.27.5. Open source

Deployment environment: Prod

I will appreciate if anyone can help on this, Thanks in advance.

Heya @ramkr123! Can you share your access and error logs when a timeout occurs? Are you using the official NGINX ECR image or are you building your own variant?

Using a full domain name within proxy_pass is totally fine if you define a resolver, which you do. Based on what you are saying I think this is more likely an AWS networking issue and/or the container getting degraded over time for some reason.

1 Like