Fix: Traefik Gateway Timeout (504)
The Cause
Traefik's default response timeout is 60 seconds. Backend services that take longer — slow database queries, large file processing, AI inference — hit this limit and return 504.
The Fix
Increase Traefik timeout in static config (traefik.yml)
serversTransport:
respondingTimeouts:
readTimeout: 300s # 5 minutes — adjust to your needs
writeTimeout: 300s
idleTimeout: 300s
Or per-router in docker-compose labels
traefik.http.routers.myapp.middlewares=timeout@docker traefik.http.middlewares.timeout.forwardauth.tls.insecureSkipVerify=false
Paste your config to detect proxy misconfigurations and get exact fixes.
Open Reverse Proxy Mapper →Frequently Asked Questions
What is Traefik's default response timeout?
Traefik's default readTimeout is 60 seconds. For services that need longer — AI model inference, video processing, large exports — increase it in the serversTransport section of your static traefik.yml config.
How do I diagnose if the timeout is in Traefik or the backend?
Check Traefik's access log for the duration field. If requests are being cut off at exactly 60 seconds, the timeout is in Traefik. If they vary, the backend is genuinely slow.