Retry

Retrying until it Succeeds

The Retry middleware is in charge of reissuing a request a given number of times to a backend server if that server does not reply. To be clear, as soon as the server answers, the middleware stops retrying, regardless of the response status.

Configuration Examples

Docker

  1. # Retry to send request 4 times
  2. labels:
  3. - "traefik.http.middlewares.test-retry.retry.attempts=4"

Kubernetes

  1. # Retry to send request 4 times
  2. apiVersion: traefik.containo.us/v1alpha1
  3. kind: Middleware
  4. metadata:
  5. name: test-retry
  6. spec:
  7. retry:
  8. attempts: 4

Consul Catalog

  1. # Retry to send request 4 times
  2. - "traefik.http.middlewares.test-retry.retry.attempts=4"

Marathon

  1. "labels": {
  2. "traefik.http.middlewares.test-retry.retry.attempts": "4"
  3. }

Rancher

  1. # Retry to send request 4 times
  2. labels:
  3. - "traefik.http.middlewares.test-retry.retry.attempts=4"

File (TOML)

  1. # Retry to send request 4 times
  2. [http.middlewares]
  3. [http.middlewares.test-retry.retry]
  4. attempts = 4

File (YAML)

  1. # Retry to send request 4 times
  2. http:
  3. middlewares:
  4. test-retry:
  5. retry:
  6. attempts: 4

Configuration Options

attempts

mandatory

The attempts option defines how many times the request should be retried.