StripPrefixRegex
Removing prefixes from the path before forwarding the request using a regex.
The StripPrefixRegex middleware strips the matching path prefix and stores it in a X-Forwarded-Prefix header.
tip
Use a stripPrefixRegex middleware if your backend listens on the root path (/) but should be exposed on a specific prefix.
Configuration Example
- Middleware StriPrefixRegex
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-stripprefixregex
spec:
stripPrefixRegex:
regex:
- "/foo/[a-z0-9]+/[0-9]+/"
Configuration Options
| Field | Description | Default | Required |
|---|---|---|---|
regex | List of regular expressions to match the path prefix from the request URL. For instance, /products also matches /products/shoes and /products/shirts.More information here. | No |