events { worker_connections 1024; } http { client_max_body_size 15m; upstream api_cluster { server api:8000 max_fails=2 fail_timeout=5s; keepalive 64; } server { listen 8080; location / { proxy_pass http://api_cluster; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Request-Id $http_x_request_id; proxy_next_upstream error timeout http_502 http_503 http_504 non_idempotent; proxy_next_upstream_timeout 10s; proxy_next_upstream_tries 3; proxy_connect_timeout 2s; proxy_read_timeout 10s; } } }