Back to Traefik

Traefik Proxy Middleware Overview

docs/content/reference/routing-configuration/http/middlewares/overview.md

3.7.16.4 KB
Original Source

HTTP Middleware Overview

Attached to routers or services, pieces of middleware are a means of tweaking the requests before they are sent to your backend servers (or before the answer is sent to the clients).

Middlewares can be attached at two levels:

  • Router-level: Applied to all requests matching the router's rule, before forwarding to the service.
  • Service-level: Applied to all requests handled by the service, regardless of which router forwards the request. See service middlewares.

When both are configured, router middlewares execute first, followed by service middlewares.

There are several available middlewares in Traefik, some can modify the request, the headers, some are in charge of redirections, some add authentication, and so on.

Middlewares that use the same protocol can be combined into chains to fit every scenario.

!!! warning "Provider Namespace"

Be aware of the concept of Providers Namespace described in the [Configuration Discovery](../../../install-configuration/providers/overview.md#provider-namespace) section.
It also applies to Middlewares.

Available HTTP Middlewares

MiddlewarePurposeArea
<a id="opt-AddPrefix" href="#opt-AddPrefix" title="#opt-AddPrefix">AddPrefix</a>Adds a Path PrefixPath Modifier
<a id="opt-BasicAuth" href="#opt-BasicAuth" title="#opt-BasicAuth">BasicAuth</a>Adds Basic AuthenticationSecurity, Authentication
<a id="opt-Buffering" href="#opt-Buffering" title="#opt-Buffering">Buffering</a>Buffers the request/responseRequest Lifecycle
<a id="opt-Chain" href="#opt-Chain" title="#opt-Chain">Chain</a>Combines multiple pieces of middlewareMisc
<a id="opt-CircuitBreaker" href="#opt-CircuitBreaker" title="#opt-CircuitBreaker">CircuitBreaker</a>Prevents calling unhealthy servicesRequest Lifecycle
<a id="opt-Compress" href="#opt-Compress" title="#opt-Compress">Compress</a>Compresses the responseContent Modifier
<a id="opt-ContentType" href="#opt-ContentType" title="#opt-ContentType">ContentType</a>Handles Content-Type auto-detectionMisc
<a id="opt-DigestAuth" href="#opt-DigestAuth" title="#opt-DigestAuth">DigestAuth</a>Adds Digest AuthenticationSecurity, Authentication
<a id="opt-EncodedCharacters" href="#opt-EncodedCharacters" title="#opt-EncodedCharacters">EncodedCharacters</a>Defines allowed reserved encoded characters in the request pathSecurity, Request Lifecycle
<a id="opt-Errors" href="#opt-Errors" title="#opt-Errors">Errors</a>Defines custom error pagesRequest Lifecycle
<a id="opt-ForwardAuth" href="#opt-ForwardAuth" title="#opt-ForwardAuth">ForwardAuth</a>Delegates AuthenticationSecurity, Authentication
<a id="opt-GrpcWeb" href="#opt-GrpcWeb" title="#opt-GrpcWeb">GrpcWeb</a>Converts gRPC Web requests to HTTP/2 gRPC requests.Request
<a id="opt-Headers" href="#opt-Headers" title="#opt-Headers">Headers</a>Adds / Updates headersSecurity
<a id="opt-IPAllowList" href="#opt-IPAllowList" title="#opt-IPAllowList">IPAllowList</a>Limits the allowed client IPsSecurity, Request lifecycle
<a id="opt-InFlightReq" href="#opt-InFlightReq" title="#opt-InFlightReq">InFlightReq</a>Limits the number of simultaneous connectionsSecurity, Request lifecycle
<a id="opt-PassTLSClientCert" href="#opt-PassTLSClientCert" title="#opt-PassTLSClientCert">PassTLSClientCert</a>Adds Client Certificates in a HeaderSecurity
<a id="opt-RateLimit" href="#opt-RateLimit" title="#opt-RateLimit">RateLimit</a>Limits the call frequencySecurity, Request lifecycle
<a id="opt-RedirectScheme" href="#opt-RedirectScheme" title="#opt-RedirectScheme">RedirectScheme</a>Redirects based on schemeRequest lifecycle
<a id="opt-RedirectRegex" href="#opt-RedirectRegex" title="#opt-RedirectRegex">RedirectRegex</a>Redirects based on regexRequest lifecycle
<a id="opt-ReplacePath" href="#opt-ReplacePath" title="#opt-ReplacePath">ReplacePath</a>Changes the path of the requestPath Modifier
<a id="opt-ReplacePathRegex" href="#opt-ReplacePathRegex" title="#opt-ReplacePathRegex">ReplacePathRegex</a>Changes the path of the requestPath Modifier
<a id="opt-Retry" href="#opt-Retry" title="#opt-Retry">Retry</a>Automatically retries in case of errorRequest lifecycle
<a id="opt-StripPrefix" href="#opt-StripPrefix" title="#opt-StripPrefix">StripPrefix</a>Changes the path of the requestPath Modifier
<a id="opt-StripPrefixRegex" href="#opt-StripPrefixRegex" title="#opt-StripPrefixRegex">StripPrefixRegex</a>Changes the path of the requestPath Modifier

Community Middlewares

Please take a look at the community-contributed plugins in the plugin catalog.

{% include-markdown "includes/traefik-for-business-applications.md" %}