# HTTP Middlewares Overview HTTP Middlewares in Traefik let you modify requests and responses on the fly. You can configure them in multiple ways (Docker labels, TOML, YAML, etc.).
Configuration Example in a docker-compose.yaml ### Configuration Example in a `docker-compose.yaml` ```yaml # As a Docker Label whoami: # A container that exposes an API to show its IP address image: traefik/whoami labels: # Create a middleware named `foo-add-prefix` - "traefik.http.middlewares.foo-add-prefix.addprefix.prefix=/foo" # Apply the middleware named `foo-add-prefix` to the router named `router1` - "traefik.http.routers.router1.middlewares=foo-add-prefix@docker" ```
Configuration Example in a dynamic.toml ### Configuration Example in a `dynamic.toml` ```toml [http.routers] [http.routers.router1] service = "service1" middlewares = ["foo-add-prefix"] rule = "Host(`example.com`)" [http.middlewares] [http.middlewares.foo-add-prefix.addPrefix] prefix = "/foo" [http.services] [http.services.service1] [http.services.service1.loadBalancer] [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:80" ```
Configuration Example in a dynamic.yml ### Configuration Example in a `dynamic.yml` ```yaml http: routers: router1: service: service1 middlewares: - "foo-add-prefix" rule: "Host(`example.com`)" middlewares: foo-add-prefix: addPrefix: prefix: "/foo" services: service1: loadBalancer: servers: - url: "http://127.0.0.1:80" ```
### Available HTTP Middlewares
MiddlewarePurposeArea
[AddPrefix](https://doc.traefik.io/traefik/middlewares/http/addprefix/)Adds a Path PrefixPath Modifier
[BasicAuth](https://doc.traefik.io/traefik/middlewares/http/basicauth/)Adds Basic AuthenticationSecurity, Authentication
[Buffering](https://doc.traefik.io/traefik/middlewares/http/buffering/)Buffers the request/responseRequest Lifecycle
[Chain](https://doc.traefik.io/traefik/middlewares/http/chain/)Combines multiple pieces of middlewareMisc
[CircuitBreaker](https://doc.traefik.io/traefik/middlewares/http/circuitbreaker/)Prevents calling unhealthy servicesRequest Lifecycle
[Compress](https://doc.traefik.io/traefik/middlewares/http/compress/)Compresses the responseContent Modifier
[ContentType](https://doc.traefik.io/traefik/middlewares/http/contenttype/)Handles Content-Type auto-detectionMisc
[DigestAuth](https://doc.traefik.io/traefik/middlewares/http/digestauth/)Adds Digest AuthenticationSecurity, Authentication
[Errors](https://doc.traefik.io/traefik/middlewares/http/errorpages/)Defines custom error pagesRequest Lifecycle
[ForwardAuth](https://doc.traefik.io/traefik/middlewares/http/forwardauth/)Delegates AuthenticationSecurity, Authentication
[Headers](https://doc.traefik.io/traefik/middlewares/http/headers/)Adds / Updates headersSecurity
[IPAllowList](https://doc.traefik.io/traefik/middlewares/http/ipallowlist/)Limits the allowed client IPsSecurity, Request lifecycle
[InFlightReq](https://doc.traefik.io/traefik/middlewares/http/inflightreq/)Limits the number of simultaneous connectionsSecurity, Request lifecycle
[PassTLSClientCert](https://doc.traefik.io/traefik/middlewares/http/passtlsclientcert/)Adds Client Certificates in a HeaderSecurity
[RateLimit](https://doc.traefik.io/traefik/middlewares/http/ratelimit/)Limits the call frequencySecurity, Request lifecycle
[RedirectScheme](https://doc.traefik.io/traefik/middlewares/http/redirectscheme/)Redirects based on schemeRequest lifecycle
[RedirectRegex](https://doc.traefik.io/traefik/middlewares/http/redirectregex/)Redirects based on regexRequest lifecycle
[ReplacePath](https://doc.traefik.io/traefik/middlewares/http/replacepath/)Changes the path of the requestPath Modifier
[ReplacePathRegex](https://doc.traefik.io/traefik/middlewares/http/replacepathregex/)Changes the path of the requestPath Modifier
[Retry](https://doc.traefik.io/traefik/middlewares/http/retry/)Automatically retries in case of errorRequest lifecycle
[StripPrefix](https://doc.traefik.io/traefik/middlewares/http/stripprefix/)Changes the path of the requestPath Modifier
[StripPrefixRegex](https://doc.traefik.io/traefik/middlewares/http/stripprefixregex/)Changes the path of the requestPath Modifier
For even more options, check out the [community-contributed plugins](https://plugins.traefik.io/plugins) in the plugin catalog.