From ae6caf158a9c5e902923c755a9b1bc5a8b3f4cb5 Mon Sep 17 00:00:00 2001 From: sakkiii Date: Fri, 3 Sep 2021 12:30:45 +0530 Subject: [PATCH] Added variable matrix_nginx_proxy_request_timeout (#1265) * add timeout param for nginx proxy default value matrix_nginx_proxy_request_timeout is 60s * default matrix_nginx_proxy_request_timeout - 60s * few more variables for request timeout * Update nginx.conf.j2 * Update nginx.conf.j2 --- roles/matrix-nginx-proxy/defaults/main.yml | 17 +++++++++++++++++ .../templates/nginx/nginx.conf.j2 | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/roles/matrix-nginx-proxy/defaults/main.yml b/roles/matrix-nginx-proxy/defaults/main.yml index 75b84d7c7..f64b161f2 100644 --- a/roles/matrix-nginx-proxy/defaults/main.yml +++ b/roles/matrix-nginx-proxy/defaults/main.yml @@ -282,6 +282,23 @@ matrix_nginx_proxy_proxy_sygnal_additional_server_configuration_blocks: [] # A list of strings containing additional configuration blocks to add to the base domain server configuration (matrix-base-domain.conf). matrix_nginx_proxy_proxy_domain_additional_server_configuration_blocks: [] +# To increase request timeout in NGINX using proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout, send_timeout directives +# Nginx Default: proxy_connect_timeout 60s; #Defines a timeout for establishing a connection with a proxied server +# Nginx Default: proxy_send_timeout 60s; #Sets a timeout for transmitting a request to the proxied server. +# Nginx Default: proxy_read_timeout 60s; #Defines a timeout for reading a response from the proxied server. +# Nginx Default: send_timeout 60s; #Sets a timeout for transmitting a response to the client. +# +# For more information visit: +# http://nginx.org/en/docs/http/ngx_http_proxy_module.html +# http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout +# https://www.nginx.com/resources/wiki/start/topics/examples/fullexample2/ +# +# Here we are sticking with nginx default values change this value carefully. +matrix_nginx_proxy_connect_timeout: 60 +matrix_nginx_proxy_send_timeout: 60 +matrix_nginx_proxy_read_timeout: 60 +matrix_nginx_send_timeout: 60 + # Controls whether to send a "Permissions-Policy interest-cohort=();" header along with all responses for all vhosts meant to be accessed by users. # # Learn more about what it is here: diff --git a/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 index 9ec7fa560..1084d8cab 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 @@ -42,6 +42,11 @@ http { {% else %} access_log off; {% endif %} + + proxy_connect_timeout {{ matrix_nginx_proxy_connect_timeout }}; + proxy_send_timeout {{ matrix_nginx_proxy_send_timeout }}; + proxy_read_timeout {{ matrix_nginx_proxy_read_timeout }}; + send_timeout {{ matrix_nginx_send_timeout }}; sendfile on; #tcp_nopush on;