This traefik plugin filters incoming requests based on easy-to-configure rules using the Common Expression Language (CEL). The intended use is for small sites that want to block or log certain requests without needing a full WAF solution.
Rules are written in YAML and use CEL expressions for matching:
actions:myresponse:log: off # off(default), debug, info, warn, errorresponse: { status: 403, body: "", header: {} } # default is status:403, no body, no extra headercontinue: false # true, false(default) - do no continuerules:- name: useragentdisabled: falsetests:- request.header.contains('user-agent') == falseaction: myresponse # optional, default action is 403 without body
You can match on any part of the request:
request:path: /.foobarmethod: GETversion: HTTP/1.1header:host: [whoami.localhost:8080]user-agent: [curl/8.20.0]accept: ["*/*"]
request.path.startsWith('/.')
You can experiment with CEL syntax at playcel.undistro.io.
The plugin is available on the Traefik Plugin Catalog.