How to increase 504 Gateway Timeout on Traefik

Traefik has a default timeout setting for 60s for gateway timeouts. If your backend services take longer than this to respond, you may encounter 504 Gateway Timeout errors.

In order to fix this, add the following to the command line options (often in docker-compose.yml):

docker-compose.yml
      # Disable timeouts
      - "--entrypoints.websecure.transport.respondingTimeouts.readTimeout=0"
      - "--entrypoints.websecure.transport.respondingTimeouts.writeTimeout=0"
      - "--entrypoints.websecure.transport.respondingTimeouts.idleTimeout=0"

You migh need to define this for multiple entrypoints, e.g., web and websecure, depending on your configuration. In case every long-duration request is redirected to HTTPS anyway, doing it only for websecure should be sufficient.

You can also set specific timeout values (in seconds) instead of 0 to disable them completely. After making these changes, restart your Traefik instance to apply the new settings.


Check out similar posts by category: Traefik