# HTTP 1.1 support
proxy_http_version 1.1;
#proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;

# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";

# aws default max_concurrent_requests 10
# aws default multipart_threshold     8MB
proxy_buffering on;     # GET buffering or “X-Accel-Buffering” enables or disables buffering of a response;
proxy_buffers 64 1m;  # buffers used for reading a response from the proxied server, for a single connection
proxy_buffer_size 8k; # maximum size of the data that nginx can receive from the server at a time is set
proxy_busy_buffers_size 2m;

proxy_request_buffering on;  # PUT buffering
client_body_buffer_size 64m; # buffer size for reading client request body
client_max_body_size    64m;

proxy_next_upstream error timeout non_idempotent http_500; # PUT request should be passed to the next server:
proxy_connect_timeout 200ms;
proxy_read_timeout    3s; #timeout is set only between two successive read operations
proxy_send_timeout    3s; #timeout is set only between two successive write operations
