Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2018 05:13
What would you like to do?
NGINX – Snippet: Proxy
proxy_redirect off;
client_max_body_size 64M;
client_body_buffer_size 128k;
proxy_read_timeout 10s;
proxy_connect_timeout 10s;
proxy_send_timeout 10s;
proxy_headers_hash_bucket_size 256;
proxy_headers_hash_max_size 2048;
proxy_buffering off;
proxy_buffer_size 128k;
proxy_buffers 100 128k;
# So the original HTTP Host header is preserved
proxy_set_header Host $host;
# The IP address of the client (which might be a proxy itself)
proxy_set_header X-Real-IP $remote_addr;
# The IP address in the HTTP X-Forwarded-For header (which would be the 'origin' client).
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Accept-Encoding "";
proxy_next_upstream http_500 http_502 http_503 http_504 timeout error;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment