Reverse proxy tuning

Hello !

I have a nginx reverse proxy http/https for a node.js application with
websockets (an extract of the nginx config follows).

I would like to know if there is a way to :

  • force nginx to retry connection to the same upstream if there is any
    problem with the initial request to the upstream (timeout,
    reading/writing timeouts, …)

  • do not blacklist an upstream if any error occurs

  • do not retry on another upstream

  • adjust timeouts on communications between nginx and upstreams
    (connexion, read, write, …)

I tested some parameters in the ‘tests’ block below but i’m not sure
that there is any other paramater I can play with.

http {
upstream application {
server 127.0.0.1:3030;
server 127.0.0.1:3031;
server 127.0.0.1:3032;
}
}

server {
location /nodejs/application/ {
proxy_pass http://application;
proxy_redirect off;

            # prevents 502 bad gateway error
            proxy_buffers 8 32k;
            proxy_buffer_size 64k;

            # enables WS support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;

            # tests
            proxy_connect_timeout 75s;
            proxy_read_timeout 300s;
            proxy_send_timeout 300s;
            proxy_next_upstream off;
   }

}

Thank you for your feedback.

Best regards,
Artur.

RTFM:

​The names are so close to your requests I suspect you have not made
your
part of the deal http://www.catb.org/esr/faqs/smart-questions.html.​

B. R.