Issue Details
Hello,
I'm trying to block access to clients based on their user agent, using the header_regexp matcher. I originally put the regexp in my Caddyfile but decided to move it in another file located at /etc/caddy/bots-list.txt and to use the {file.*} placeholder to read its content:
(noscrap) {
# Originally was
# @botForbidden header_regexp User-Agent "AI2Bot|AI2Bot-DeepResearchEval|..."
@botForbidden header_regexp User-Agent {file./etc/caddy/bots-list.txt}
handle @botForbidden {
respond /* "Access denied" 403 {
close
}
}
}
foo.example.com {
reverse_proxy 172.22.0.14:5000
import noscrap
}
The issue is that live config does not reflect the content of bots-list.txt:
$ curl "http://localhost:2019/config/"
{
"admin": {
"listen": "tcp/localhost:2019"
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"group": "group24",
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "Access denied",
"close": true,
"handler": "static_response",
"status_code": 403
}
],
"match": [
{
"path": [
"/*"
]
}
]
}
]
}
],
"match": [
{
"header_regexp": {
"User-Agent": {
"name": "botForbidden",
"pattern": "{file./etc/caddy/bots-list.txt}"
}
}
}
]
},
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "172.22.0.14:5000"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"foo.example.com"
]
}
],
"terminal": true
}
]
}
}
}
}
}
You can see that the matcher botForbidden read "pattern": "{file./etc/caddy/bots-list.txt}" when I expect it to read "pattern": "AI2Bot|AI2Bot-DeepResearchEval|..."
I have search across GitHub and the forum but found nothing similar to my issue, making me wonder if this is a bug.
Assistance Disclosure
AI not used
If AI was used, describe the extent to which it was used.
No response
Issue Details
Hello,
I'm trying to block access to clients based on their user agent, using the
header_regexpmatcher. I originally put the regexp in myCaddyfilebut decided to move it in another file located at/etc/caddy/bots-list.txtand to use the{file.*}placeholder to read its content:The issue is that live config does not reflect the content of
bots-list.txt:You can see that the matcher
botForbiddenread"pattern": "{file./etc/caddy/bots-list.txt}"when I expect it to read"pattern": "AI2Bot|AI2Bot-DeepResearchEval|..."I have search across GitHub and the forum but found nothing similar to my issue, making me wonder if this is a bug.
Assistance Disclosure
AI not used
If AI was used, describe the extent to which it was used.
No response