1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
caddy.exe run --config Caddyfile
a. System environment:
Any
b. Command:
caddy.exe run --config Caddyfile
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
http://127.0.0.1:8080 {
@old {
header_regexp User-Agent (?i)(Chrome|CriOS)/(9|8|7|6|5|4|3|2)
header_regexp User-Agent (?i)Firefox/(9|8|7|6|5|4|3|2)
header_regexp User-Agent (?i)NT\s(6|5|4|3)\.
}
respond @old 403
file_server /static/*
}
3. The problem I’m having:
Unfortunately as expected, caddy.exe exits with an error
4. Error messages and/or full log output:
`Error: adapting config using caddyfile: Caddyfile:5 - Error during parsing: header_regexp matcher can only be used once per named matcher, per header field: User-Agent`
5. What I already tried:
Well not much, I know this isn’t supported, it says so in the Docs, but that’s why I’m creating this topic, I would like it to be supported. I don’t see the purpose of the limitation other than for the performance hit, but IMO the decision to take the performance hit should be up to me.
Caddy v1 can OR multiple matcher tokens together of any token type with the “if_op or” (and then a “rewrite hack” to send a 403) I want the same for v2 except there would be no need for the rewrite hack part obviously.
Now I know even if I could do multiple header_regexp it wouldn’t be the most efficient way to block old clients, but please let’s not focus on that.
I guess what I’m trying to achieve is something like the “apache ultimate bad bot blocker” list in Caddy, I’d have the @old matcher that naively blocks old clients, and another that would block bad bots that annoyingly request my site except no more than 60 or so matches.
To achieve such things, it’s impossible without being able to add multiple header regex matches.
Thanks for your time, and apologies in advance if I’m out of my lane asking to add support for this.