A Traefik middleware changes or checks an HTTP request after a router matches it and before Traefik forwards it to the service. It can rewrite paths, modify headers, or enforce authentication. section 20.4
Use middleware when a routed request needs an adjustment before reaching its upstream container:
- Strip an API path prefix when the application expects the path without that prefix. section 20.4
- Change request headers or enforce authentication before forwarding traffic. section 20.4
Expose an API beneath a shared domain
Route requests for the image gallery domain with an /api prefix, then use middleware to remove that prefix before forwarding the request to the API service. Verify both the website and API with curl. section 20.4









