Added proxy buffering, needed for new horizon setups
diff --git a/README.rst b/README.rst
index 2c9a554..108e558 100644
--- a/README.rst
+++ b/README.rst
@@ -130,6 +130,29 @@
             enabled: true
             password: magicunicorn
 
+Proxy buffering
+
+.. code-block:: yaml
+
+    nginx:
+      server:
+        enabled: true
+        bind:
+          address: '0.0.0.0'
+          ports:
+          - 80
+        site:
+          gitlab_proxy:
+            enabled: true
+            type: proxy
+            proxy:
+              buffer:
+                number: 8
+                size: 16
+            host:
+              name: gitlab.domain.com
+              port: 80
+
 Read more
 =========
 
diff --git a/nginx/files/proxy.conf b/nginx/files/proxy.conf
index 4fb0597..9623e87 100644
--- a/nginx/files/proxy.conf
+++ b/nginx/files/proxy.conf
@@ -59,7 +59,15 @@
       {%- else %}
       proxy_redirect off;
       {%- endif %}
+
+      {%- if site.proxy.buffer is defined %}
+      {%- set buffer_size = site.proxy.buffer.get('size', 16) * 2 %}
+      proxy_buffering on;
+      proxy_buffers {{ site.proxy.buffer.get('number', 8) }} {{ site.proxy.buffer.get('size', 16) }}k;
+      proxy_buffer_size {{ buffer_size }}k;
+      {%- else %}
       proxy_buffering off;
+      {%- endif %}
 
       proxy_http_version 1.1;