Skip to content

Instantly share code, notes, and snippets.

@danielpotthast
Created May 26, 2018 05:13
Show Gist options
  • Save danielpotthast/432b39d228ff7793e9bb22a0b6d2a477 to your computer and use it in GitHub Desktop.
Save danielpotthast/432b39d228ff7793e9bb22a0b6d2a477 to your computer and use it in GitHub Desktop.
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