We had a Cloudflare custom rule that blocked an admin area for every IP outside an allowlist. It looked like this:
(http.host eq "app.example.com" and starts_with(lower(http.request.uri.path), "/admin") and not ip.src in $admin_ips) It worked. Requests to /admin/login.php from outside the office got a Cloudflare 403. The usual tricks were caught too: //admin/, /./admin/, /%61dmin/ and /ADMIN/ all got 403, because the zone normalizes URLs before rules run and the rule lowercases the path.
Then this one got a 200 and the real admin login page:
https://app.example.com/;/admin/login.php Why it got through
Two components looked at the same request and disagreed about what the path was.
Cloudflare evaluated the rule against /;/admin/login.php. That string does not start with /admin, so the rule did not match. Cloudflare's URL normalization collapses duplicate slashes and resolves . and .. segments, but it leaves a segment made of a single ; alone. The request went to the origin.
Traefik sat behind Cloudflare. Since v3.7.18, with sanitizePath enabled (the default), Traefik resolves a .., . or empty segment that carries path parameters the same way as a plain dot segment or a duplicate slash. The migration notes give /foo/.;bar/baz → /foo/baz as the example. /;/ is an empty segment with a path parameter, so Traefik turned it into /, and the backend received:
GET /admin/login.php The access log on the origin showed the clean path. Nothing there looked unusual. The only place the ; was visible was Cloudflare's sampled logs for that request, where the path column read /;/admin/login.php and the mitigation column read "Not mitigated".
Neither product is doing anything wrong on its own. Traefik's behaviour is documented and intended; collapsing path-parameter segments closes a class of routing tricks inside Traefik. Cloudflare matched the rule exactly as written. The gap only exists when a security decision is made on one representation of the path and the request is then served from another.
How we found it
Not from an alert. We were reviewing a day of access logs after other suspicious activity and noticed requests to the admin login from a few hundred rotating IPs, none of them on the allowlist, all of them answered by the origin. The rule existed and was enabled, so the requests should never have reached the origin at all.
The Ray ID of one of those requests led to Cloudflare's sampled log entry, and the path in it explained everything. Logins did not succeed (the admin accounts use 2FA), but the login page and the login endpoint were reachable from anywhere.
The lesson we took from it: if a WAF rule is supposed to block a path, look at the origin's logs for that path from IPs the rule should have blocked. A rule that silently doesn't match produces no errors, only traffic you didn't expect to see.
The sibling problem: allowlisted prefixes
The same zone had a second rule with an exception. Our deployment pipeline calls an API on an internal tool from CI runners whose IPs change constantly, so the rule let one prefix through for everyone:
(http.host eq "tool.example.com" and not ip.src in $office_ips and not starts_with(http.request.uri.path, "/api/v1/applications/")) Look at it with the same eyes. A path like:
/api/v1/applications/..;/..;/..;/..;/login starts with the allowed prefix, so it passes the exception. Cloudflare does not treat ..; as a dot segment, so its normalization leaves the path alone. Traefik does treat ..; like .., so by its documented behaviour the path resolves upward and the request lands on /login, the tool's UI, which the rule was meant to hide.
We fixed this one as soon as we understood the first bypass, so we did not confirm it against the live tool beforehand. After the fix, the same path returns 403 at Cloudflare.
Prefix exceptions are where this class of bug hurts most, because the attacker doesn't need to dodge the rule. The exception does the work for them.
The fix at Cloudflare
For the blocked path, stop asking "does the path start with /admin" and ask "does /admin/ appear anywhere in the decoded path":
(lower(http.host) eq "app.example.com" and not ip.src in $admin_ips and (lower(url_decode(http.request.uri.path)) contains "/admin/" or lower(url_decode(http.request.uri.path)) contains "/admin;" or lower(url_decode(http.request.uri.path)) contains "/admin%" or ends_with(lower(url_decode(http.request.uri.path)), "/admin"))) /;/admin/login.php, /x/..;/admin/login.php and /admin;/login.php all contain one of those patterns, whatever the proxy behind Cloudflare does with them afterwards.
Check what else contains will catch before you deploy it. Our real admin path also appears inside the name of a public asset folder, so we matched "/admin/" with the trailing slash rather than "/admin", which kept the public folder reachable.
For the exception, make it refuse anything a downstream proxy might rewrite:
(lower(http.host) eq "tool.example.com" and not ip.src in $office_ips and not (starts_with(http.request.uri.path, "/api/v1/applications/") and not url_decode(http.request.uri.path) contains ";" and not url_decode(http.request.uri.path) contains ".." and not url_decode(http.request.uri.path) contains "//")) The legitimate CI calls (POST .../<app>/sync, GET .../<app>) contain none of those, so they still pass.
Then test from an IP that is not on the allowlist. That sounds obvious, but it is easy to skip: from the office every variant returns 200 and you learn nothing. A phone on mobile data is enough. Our test list after the change:
/admin/login.php 403 /;/admin/login.php 403 //admin/login.php 403 /./admin/login.php 403 /%61dmin/login.php 403 /ADMIN/login.php 403 /admin;/login.php 403 /x/..;/admin/login.php 403 /admin 403 What didn't work: blocking ; at the proxy
We wanted a second layer at the origin that didn't depend on keeping an IP list in two places. We already ran a small Traefik plugin as entry-point middleware on every request, so we added a check: if the raw request target contains ; in its path, answer 400.
It caught /admin;/login.php. It did not catch /;/admin/login.php.
The reason is ordering. Traefik's path sanitizing runs before entry-point middleware, and by the time our plugin looked at RequestURI, the /;/ segment was already gone. /admin;/ survived only because a ; attached to a normal segment is not something sanitizing touches. Traefik's documentation doesn't spell out which representation a middleware sees, and we only learned it by testing. If you try the same thing, test it with a request the sanitizer actually rewrites, not just one containing a semicolon.
Why not just turn off sanitizePath?
It's tempting: with sanitizing off, /;/admin/login.php reaches the backend unchanged, a strict check in the proxy can reject it, and the backend (nginx in our case) would not map it to the admin script anyway.
Traefik's own migration notes describe sanitizePath: false as unsafe and meant for legacy clients. It changes path handling for every host behind that entry point, not just the one you are worried about, and any router or middleware that makes decisions on the path would then see unsanitized input. We decided that trading a narrow, understood gap for a broad change in behaviour across every site was the wrong direction, and kept the fix at Cloudflare, where the decision is made.
Check your URL normalization scope
While looking into this we found that our zones were not configured the same way. Cloudflare's URL normalization has a scope:
- incoming: rules see the normalized URL, the origin gets the original
- both: rules see it and the origin gets it too
- none: no normalization at all
One of our zones was set to none. On that zone, every path-based rule was matching raw, unnormalized paths, so //, /./ and percent-encoded variants weren't guaranteed to be caught the way they were elsewhere. It is worth checking every zone that has path-based security rules, because the setting is per zone and easy to leave at whatever it was when the zone was created.
Takeaways
- A WAF rule and the proxy behind it each have their own idea of what a path is. If they can disagree, an attacker can choose the version each one sees.
- Prefer
containson the decoded path overstarts_withfor blocking. For allowlisted exceptions, refuse;,..and//explicitly. - Know your proxy's path rewriting. Traefik 3.7.18+ resolves dot and empty segments that carry
;parameters; other proxies have their own rules. - Test from outside the allowlist, with the encoded, doubled and parameterized variants, after every rule change.
- Read origin logs for paths that should be blocked. If they show up at all, the rule isn't doing what you think.
References
- Traefik v3 migration notes (path sanitizing changes): https://doc.traefik.io/traefik/migrate/v3/
- Traefik request path security: https://doc.traefik.io/traefik/security/request-path/
- Cloudflare URL normalization: https://developers.cloudflare.com/rules/normalization/

