Skip to content

Commit

Permalink
Merge pull request #637 from loadpi/Add-nginx-keepalive-timeout
Browse files Browse the repository at this point in the history
add nginx keepalive_timeout env to prevent race condition on gorouter
  • Loading branch information
sailhenz authored May 31, 2023
2 parents d51c18b + 72f29ce commit 146e1f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions buildpack/core/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def update_config():
samesite_cookie_workaround_enabled=samesite_cookie_workaround_enabled,
locations=_get_locations(),
default_headers=_get_http_headers(),
nginx_keepalive_timeout=_get_nginx_keepalive_timeout(),
nginx_port=str(util.get_nginx_port()),
runtime_port=str(util.get_runtime_port()),
admin_port=str(util.get_admin_port()),
Expand Down Expand Up @@ -136,6 +137,10 @@ def update_config():
_generate_password_file({"MxAdmin": security.get_m2ee_password()})


def _get_nginx_keepalive_timeout():
return os.environ.get("NGINX_KEEPALIVE_TIMEOUT", "30")


def _get_proxy_buffer_size():
return os.environ.get("NGINX_PROXY_BUFFER_SIZE", None)

Expand Down
2 changes: 1 addition & 1 deletion etc/nginx/conf/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ http {
gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;

tcp_nopush on;
keepalive_timeout 30;
keepalive_timeout {{ nginx_keepalive_timeout }};
absolute_redirect off;
server_tokens off;

Expand Down

0 comments on commit 146e1f5

Please sign in to comment.