NGINX returns 416 Range Not Satisfiable for resumed downloads when using X-Accel-Mirror to an S3‑compatible backend
Environment
Ubuntu 22.04 NGINX 1.24.0 using X-Accel-Mirror to proxy internal S3-compatible object store (MinIO vRELEASE-2023), TLS terminated at edge, clients download large files with HTTP Range resume requests
Symptoms
Clients attempting to resume large downloads (Range: bytes=nnn-) receive HTTP/1.1 416 Range Not Satisfiable from NGINX only when X-Accel-Mirror is active; direct GETs to storage return 206/partial content correctly.
Observations
Access logs show NGINX returning 416 for requests that include Range header; upstream object store responded successfully to identical Range requests when queried directly from the webserver host. X-Accel-Mirror passes a rewritten internal URI to internal location that issues proxy_pass to storage. No byte-range rewrites are configured in NGINX beyond mirror handling.
Already attempted
Restarted NGINX, tested with curl --range from server to storage (works), toggled X-Accel-Mirror on/off (416 appears only with mirror), set proxy_buffering off (no effect), compared request/response headers between direct and mirrored proxied requests.
Question
Why does NGINX return 416 for range-resume only when using X-Accel-Mirror to mirror requests to the S3 backend, and how can I restore proper 206 resume support without disabling mirror behavior?
Verified community troubleshooting
First check whether the mirror/internal location is forwarding the Range header. Add in that location: proxy_set_header Range $http_range; proxy_set_header Accept-Ranges bytes;. Also temporarily disable buffering there (proxy_buffering off; proxy_max_temp_file_size 0;) and retest; if 206 resumes return, buffering was the issue. Verify the internal URI uses the same key/credentials as your direct test—signed URLs or different hostnames can cause upstream to return metadata that disallows ranges. To roll back, restore proxy buffering and remove the added proxy_set_header if it causes other regressions; if issues persist, reproduce with minimal config on a staging host and escalate to your object-store vendor or NGINX package maintainer.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Cloud Computing26% match
Kubernetes Ingress returns 404 for POST requests only when client uses HTTP/2 to the edge (ingress-nginx misroutes upgraded requests)
Open0 answers - Cloud Computing23% match
MinIO S3 gateway returns checksum mismatch on GETs for large multipart objects after changing part_size
Open1 answer - Web Development23% match
Nginx returns 504 Gateway Timeout only for backend requests over ~45s to my Node API
Open1 answer - Web Development23% match
NGINX returns 502 only for long-running Node.js API endpoints while short requests succeed
Open0 answers - Web Development22% match
NGINX returns 504 Gateway Timeout for long-running uploads through a Node backend — how to diagnose?
Open1 answer