Skip to main content

Encoded Characters

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

When this middleware is attached to a router, potentially dangerous encoded characters are rejected by default for security enhancement. Each encoded character can be individually allowed via its dedicated option.

This middleware applies per-router, in addition to (and overriding for matched requests) the global encodedCharacters entry point options.


Configuration Examples

Allow encoded slash in the request path
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-encodedchars
namespace: apps
spec:
encodedCharacters:
allowEncodedSlash: true

Configuration Options

When configuring these options, ensure that your backend is fully compliant with RFC 3986. This avoids split-view situations where Traefik Hub API Gateway and your backend interpret the same URL differently.

FieldDescriptionDefaultRequired
allowEncodedSlashAllow encoded slash (%2F and %2f) in the request path.falseNo
allowEncodedBackSlashAllow encoded backslash (%5C and %5c) in the request path.falseNo
allowEncodedSemicolonAllow encoded semicolon (%3B and %3b) in the request path.falseNo
allowEncodedPercentAllow encoded percent (%25) in the request path.falseNo
allowEncodedQuestionMarkAllow encoded question mark (%3F and %3f) in the request path.falseNo
allowEncodedHashAllow encoded hash (%23) in the request path.falseNo