diff --git a/roles/nginxplus/defaults/main.yml b/roles/nginxplus/defaults/main.yml index 8811b62e17..2b30ee780b 100644 --- a/roles/nginxplus/defaults/main.yml +++ b/roles/nginxplus/defaults/main.yml @@ -437,3 +437,8 @@ nginx_stream_template: nginx_server_names_hash_bucket_size: 64 nginx_server_names_hash_max_size: 1024 client_max_body_size: 0 +# These values control how long nginx waits before +# re-routing slow requests to a different server +proxy_connect_timeout: 60s +proxy_send_timeout: 60s +proxy_read_timeout: 60s diff --git a/roles/nginxplus/templates/http/library.conf.j2 b/roles/nginxplus/templates/http/library.conf.j2 index 5831346a61..c423bc7fa6 100644 --- a/roles/nginxplus/templates/http/library.conf.j2 +++ b/roles/nginxplus/templates/http/library.conf.j2 @@ -60,6 +60,9 @@ server { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_cache {{ item.short_name }}cache; + proxy_connect_timeout {{ item.proxy_connect_timeout }}; + proxy_send_timeout {{ item.proxy_send_timeout }}; + proxy_read_timeout {{ item.proxy_read_timeout }}; # handle errors using errors.conf proxy_intercept_errors on; # TODO don't do a health check if there's only one server @@ -82,6 +85,9 @@ server { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_cache {{ item.short_name }}cache; + proxy_connect_timeout {{ item.proxy_connect_timeout }}; + proxy_send_timeout {{ item.proxy_send_timeout }}; + proxy_read_timeout {{ item.proxy_read_timeout }}; proxy_intercept_errors on; health_check interval=10 fails=3 passes=2; # allow princeton network diff --git a/roles/nginxplus/vars/main.yml b/roles/nginxplus/vars/main.yml index 8705bc3786..e8e520a793 100644 --- a/roles/nginxplus/vars/main.yml +++ b/roles/nginxplus/vars/main.yml @@ -25,6 +25,11 @@ sites: ## client_max_body_size defines the upper limit on request sizes ## default is 0 (don't check), if you change this, you must include the unit of measurement # client_max_body_size: 8m + ## proxy timeouts default to 60 seconds + ## to increase or decrease these values, set: + # proxy_connect_timeout: 2h + # proxy_send_timeout: 2h + # proxy_read_timeout: 2h ## error handling templates live in /etc/nginx/conf.d/templates/ ## the default template for handling errors is errors.conf # error_handling_template: cdh-errors.conf @@ -59,6 +64,7 @@ sites: rate_limit_mb: 10 rate_limit_per_sec: 10 rate_limit_burst_rate: 20 + # error_handling_template: changeme - name: allsearch-api-staging servers: - allsearch-api-staging1 @@ -68,6 +74,7 @@ sites: lbtechnique: least_conn client_max_body_size: 512k app_protect: enabled + # error_handling_template: changeme # - name: annotations-prod # servers: @@ -117,6 +124,9 @@ sites: # location: "/" # visibility: public # app_protect: disabled + # proxy_connect_timeout: 2h + # proxy_send_timeout: 2h + # proxy_read_timeout: 2h # - name: bibdata-qa # servers: # # - bibdata-qa1 @@ -126,6 +136,9 @@ sites: # visibility: private # added_restrictions: htc_restrict.conf # app_protect: disabled + # proxy_connect_timeout: 2h + # proxy_send_timeout: 2h + # proxy_read_timeout: 2h - name: bibdata-staging servers: # - bibdata-alma-staging1 @@ -136,6 +149,9 @@ sites: added_restrictions: - "htc_restrict.conf" app_protect: enabled + proxy_connect_timeout: 2h + proxy_send_timeout: 2h + proxy_read_timeout: 2h # - name: byzantine-tsp-prod # servers: # - byzantine-tsp-prod