From 8d59b1ac456575496e0bceb6812c59545b1e9b50 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 7 Sep 2015 13:05:29 +0200 Subject: Do not let NGINX buffer Git HTTP requests Before this change NGINX would convert a chunked HTTP POST (e.g. git push) into a HTTP 1.0 single large POST. This creates an unnecessary delay, and it creates unnecessary memory pressure on gitlab-git-http-server. For the response ('proxy_buffering') I am less sure that NGINX 's buffering behavior is harmful, but it still makes more sense to me not to interfere with gitlab-git-http-server (and the Golang net/http server). --- lib/support/nginx/gitlab | 7 +++++++ lib/support/nginx/gitlab-ssl | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index 17f89c8beb6..1cd81ea769f 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -124,6 +124,13 @@ server { proxy_connect_timeout 300; proxy_redirect off; + # Do not buffer Git HTTP responses + proxy_buffering off; + + # Pass chunked request bodies to gitlab-git-http-server as-is + proxy_request_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 5ba39fc41a4..83aad321aab 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -171,6 +171,13 @@ server { proxy_connect_timeout 300; proxy_redirect off; + # Do not buffer Git HTTP responses + proxy_buffering off; + + # Pass chunked request bodies to gitlab-git-http-server as-is + proxy_request_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Ssl on; -- cgit v1.2.3 From 783791fd08e8144a2ab97307a12df9d2a40e0421 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 7 Sep 2015 14:59:32 +0200 Subject: The good stuff needs NGINX 1.7.11 --- lib/support/nginx/gitlab | 8 +++++--- lib/support/nginx/gitlab-ssl | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index 1cd81ea769f..7218a4d2f20 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -127,9 +127,11 @@ server { # Do not buffer Git HTTP responses proxy_buffering off; - # Pass chunked request bodies to gitlab-git-http-server as-is - proxy_request_buffering off; - proxy_http_version 1.1; + # The following settings only work with NGINX 1.7.11 or newer + # + # # Pass chunked request bodies to gitlab-git-http-server as-is + # proxy_request_buffering off; + # proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 83aad321aab..7dabfba87e2 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -174,9 +174,11 @@ server { # Do not buffer Git HTTP responses proxy_buffering off; - # Pass chunked request bodies to gitlab-git-http-server as-is - proxy_request_buffering off; - proxy_http_version 1.1; + # The following settings only work with NGINX 1.7.11 or newer + # + # # Pass chunked request bodies to gitlab-git-http-server as-is + # proxy_request_buffering off; + # proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; -- cgit v1.2.3