traefik/docs/content/middlewares/retry.md

67 lines
1.3 KiB
Markdown
Raw Normal View History

2019-04-08 15:14:08 +00:00
# Retry
Retrying until it Succeeds
{: .subtitle }
2019-09-10 12:40:05 +00:00
<!--
TODO: add schema
-->
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.
2019-04-08 15:14:08 +00:00
## Configuration Examples
2019-04-08 15:14:08 +00:00
```yaml tab="Docker"
# Retry to send request 4 times
labels:
2019-09-23 15:00:06 +00:00
- "traefik.http.middlewares.test-retry.retry.attempts=4"
```
2019-04-08 15:14:08 +00:00
```yaml tab="Kubernetes"
# Retry to send request 4 times
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-retry
spec:
retry:
attempts: 4
```
```json tab="Marathon"
"labels": {
"traefik.http.middlewares.test-retry.retry.attempts": "4"
}
```
2019-04-08 15:14:08 +00:00
```yaml tab="Rancher"
# Retry to send request 4 times
labels:
2019-09-23 15:00:06 +00:00
- "traefik.http.middlewares.test-retry.retry.attempts=4"
2019-04-08 15:14:08 +00:00
```
2019-07-22 07:58:04 +00:00
```toml tab="File (TOML)"
2019-04-08 15:14:08 +00:00
# Retry to send request 4 times
[http.middlewares]
2019-07-01 09:30:05 +00:00
[http.middlewares.test-retry.retry]
2019-04-08 15:14:08 +00:00
attempts = 4
```
2019-07-22 07:58:04 +00:00
```yaml tab="File (YAML)"
# Retry to send request 4 times
http:
middlewares:
test-retry:
retry:
attempts: 4
```
2019-04-08 15:14:08 +00:00
## Configuration Options
### `attempts`
_mandatory_
2019-09-23 15:00:06 +00:00
The `attempts` option defines how many times the request should be retried.