Skip to content

EncodedCharacters

The EncodedCharacters middleware controls which ambiguous reserved encoded characters are allowed in the request path.

When you use this middleware, by default, potentially dangerous encoded characters are rejected for security enhancement.

Configuration Examples

# Allow encoded slash in the request path.
labels:
  - "traefik.http.middlewares.test-encodedchars.encodedcharacters.allowencodedslash=true"
# Allow encoded slash in the request path.
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: test-encodedchars
spec:
  encodedCharacters:
    allowEncodedSlash: true
# Allow encoded slash in the request path.
- "traefik.http.middlewares.test-encodedchars.encodedcharacters.allowencodedslash=true"
# Allow encoded slash in the request path.
http:
  middlewares:
    test-encodedchars:
      encodedCharacters:
        allowEncodedSlash: true
# Allow encoded slash in the request path.
[http.middlewares]
  [http.middlewares.test-encodedchars.encodedCharacters]
    allowEncodedSlash = true

Configuration Options

When you are configuring these options, check if your backend is fully compliant with RFC 3986. This helps avoid split-view situation, where Traefik and your backend interpret the same URL differently.

Field Description Default Required
allowEncodedSlash Allow encoded slash (%2F and %2f) in the request path. false No
allowEncodedBackSlash Allow encoded backslash (%5C and %5c) in the request path. false No
allowEncodedSemicolon Allow encoded semicolon (%3B and %3b) in the request path. false No
allowEncodedPercent Allow encoded percent (%25) in the request path. false No
allowEncodedQuestionMark Allow encoded question mark (%3F and %3f) in the request path. false No
allowEncodedHash Allow encoded hash (%23) in the request path. false No