Skip to main content

Manage the errors

Traefik Hub API Gateway provides pieces of middleware to manage errors:

Retry Requests in Error

The example shows how to configure Traefik Hub API Gateway to send a request 4 times to a backend before returning an error.

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-retry
spec:
retry:
attempts: 4

Display a Custom Error Page

The example shows how to display the page error-404.html when the backend returns a HTTP Status 404:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: error-page
spec:
errors:
status:
- "404"
- "500-599"
query: '/{status}.html'
service:
name: error-page
port: "http"