3

In application I want to increase connection timeout as there is functionality to upload huge files. Currently I found the next properties:

 proxy_connect_timeout     20;
 proxy_send_timeout        20;
 proxy_read_timeout        20;

But the thing is that I looking to not allow so long connection through all endpoint but only for particular one.

Is there some way to configure Nginx "connection timeout" for particular request pattern?

1 Answer 1

4

Yes! One of the nice things about nginx is that you can set values in a hierarchy depending on locations, paths, parameters, source IP addresses ... basically on any metadata.

server {
    listen 443 ssl http2;
    ....
    # default timeouts here
    proxy_connect_timeout <smallval>;
    proxy_send_timeout <smallval>;
    proxy_read_timeout <smallval>;

    location /biguploadshere {
        proxy_connect_timeout <bigval>;
        proxy_send_timeout <bigval>;
        proxy_read_timeout <bigval>;
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

PaulProgrammer is it also possible for ingress configs ?
Yes, though there are special configuration requirements. There's an example on the nginx ingress controller github site here: github.com/nginxinc/kubernetes-ingress/blob/master/docs/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.