Traefik v3.6: How to handle large streaming uploads over HTTPS/HTTP2 #8300
Replies: 1 comment
-
|
im not sure of the solution, but afaik traefik does not have a 5 minute timeout it has a 60 second read timeout there is no forwarding timeout to the backend that would close after 5 minutes if the upload to traefik takes the same time but only fails when streaming to the backend, then the issue is not client->traefik but traefik->backend, since the request to traefik takes the same amount of time. my suspicion is if the backend closes the connection after 5 minutes, this cancels the context in traefik, so it would then respond with a 408, the origin status is not set as it didn't respond but closed the connection. as a test, can you bypass the proxy, and directly map your backend to a port, and try and upload directly to your backend, if it works, then the issue is somewhere in either traefik or go net/http (i think there might be a difference in http 1.1 vs http 2), if it still fails then you know the timeout is in node/backend |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Traefik v3.6: Large streaming uploads over HTTPS/HTTP2 return 408 after ~5 minutes unless request buffering middleware is enabled
Environment
https://api.devbranch.devGoal
Support large file uploads (60MB+) that can take 5–6+ minutes over slow connections, while:
Traefik (coolify-proxy) Configuration
coolify-proxyservice (simplified):Application-Level Traefik Labels
When
upload-streamis NOT applied to the upload router:Uploads are streamed end-to-end.
Node (Busboy) sees bytes gradually and emits Socket.IO
upload-progressevents correctly.For large uploads (~135MB) over a slow connection, after ~5.1–5.3 minutes the browser sees:
408 Request Timeout
net::ERR_FAILED 408 (Request Timeout)
Access to XMLHttpRequest at 'https://api.devbranch.dev/api/v1/admin/.../uploads/videos'
from origin 'https://backoffice.devbranch.dev' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
{ "ClientAddr":"146.70.62.93:35197", "DownstreamContentSize":0, "DownstreamStatus":408, "Duration":306442633433, "OriginContentSize":0, "OriginStatus":0, "OriginDuration":306442525634, "RequestMethod":"POST", "RequestPath":"/api/v1/admin/courses/69804f524855ffb6014732b7/uploads/videos", "RequestContentSize":134880875, "RequestHost":"api.devbranch.dev", "RequestProtocol":"HTTP/2.0", "RouterName":"https-0-xk8osscwck4o84kskgok4ws0@docker", "ServiceAddr":"172.18.0.11:3000", "ServiceName":"api-service@docker", "ServiceURL":"http://172.18.0.11:3000", "StartUTC":"2026-02-12T08:06:34.853439035Z", "entryPointName":"https" }Interpretation:
DownstreamStatus: 408andDuration ≈ 306s→ Traefik itself is returning the 408 after ~5.1 minutes.OriginStatus: 0→ Traefik never got a response from the backend (the client was still uploading).Behavior 2 – With
upload-streambuffering middlewareWhen I attach the
upload-streambuffering middleware to the upload router:traefik.http.routers.upload-https.middlewares=gzip,upload-streamThen:upload-progressevents 0 → 100% in a burst at the end.So:
Without
upload-stream:With
upload-stream:What I Tried
respondingTimeouts.*on bothhttpandhttpsentrypoints to1200sdid not change the ~5 minute behavior when streaming a large request body.--entrypoints.https.transport.readTimeout=1200s/writeTimeout=1200setc. caused Traefik to fail startup (invalid flags for v3.6).coolify-proxy).Question
In Traefik v3.6:
408 Request Timeout?bufferingmiddleware (like myupload-streamconfig) currently the only supported way to avoid this client body read timeout for large uploads?Beta Was this translation helpful? Give feedback.
All reactions