worker_processes 1; worker_shutdown_timeout 8s; events { worker_connections 1024; } http { upstream messenger { zone messenger 64k; include /etc/nginx/ready-backends.conf; } log_format upstream '$request_method $uri $status upstream=$upstream_addr ' 'upstream_status=$upstream_status time=$request_time'; access_log /var/log/nginx/access.log upstream; server { listen 8080; client_max_body_size 64k; client_body_timeout 5s; client_header_timeout 5s; keepalive_timeout 5s; location / { proxy_pass http://messenger; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header Connection close; proxy_connect_timeout 1s; proxy_send_timeout 6s; proxy_read_timeout 6s; proxy_next_upstream error timeout http_502 http_503 http_504; proxy_next_upstream_tries 2; proxy_next_upstream_timeout 8s; # Never transparently retry a POST already sent to an API. # A client retries messages using the original Idempotency-Key. } } }