anubis: [Bug] Custom policies not registering
I’m using a docker compose setup like so:
anubis-nginx:
image: ghcr.io/techarohq/anubis:latest
environment:
BIND: ":54301"
COOKIE_DOMAIN: "ggtyler.dev"
DIFFICULTY: "4"
METRICS_BIND: ":9090"
TARGET: "http://inv-nginx:3000"
POLICY_FNAME: "/data/cfg/botPolicy.json"
SERVE_ROBOTS_TXT: "true"
ports:
- 54301:54301
- 59090:9090
volumes:
- "./botPolicy.json:/data/cfg/botPolicy.json:ro"
And on my bot policy file, I have something written like:
{
"bots": [
{
"name": "rss",
"path_regex": "^/feed/.*$",
"action": "ALLOW"
},
{
"name": "embed",
"path_regex": "^/embed/.*$",
"action": "ALLOW"
},
{
"name": "test",
"user_agent_regex": "Mozilla test test test",
"action": "ALLOW"
}
]
}
However, none of these definitions seem to go through:
$ curl https://nyc1.iv.ggtyler.dev/api/v1/stats
{"version":"2.0","software":{"name":"invidious","version":"2025.04.04-713d4dd","branch":"master"},"openRegistrations":true,"usage":{"users":{"total":4712,"activeHalfyear":222,"activeMonth":39}},"metadata":{"updatedAt":1744948806,"lastChannelRefreshedAt":1744866521},"playback":{}}%
$ curl -A "Mozilla test test test" https://nyc1.iv.ggtyler.dev/api/v1/stats
<!doctype html><html lang="en"><head><title>Making sure you're not a bot!</title><link rel="stylesheet" href="/.within.website/x/xess/xess.min.css?cachebuster=v1.16.0"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="robots" content="noindex,nofollow"><style>
# resulting HTML from anubis
I can verify that botPolicy.json is being mounted on Docker via docker inspect, so it’s seemingly not a docker issue. If I had to guess, the default policies are possibly overriding the custom ones? I’m not even sure if the rules are being added or if the file is just being completely ignored…
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (4 by maintainers)
Hi, sorry, I’m not sure why I didn’t get a notification when Xe replied.
It turns out that since posting this issue, Anubis magically started accepting my botPolicy… and then proceeding to remove the default ones and allow everything 😥 But at least it seems to be working now.
Gotcha, the json from that branch works, thank you ^^
Importing like that is a v1.18.0 feature, copy from the v1.17.1 template
You can probably keep this one, I’ll need to make a new issue for this and the default policies being removed:
Can you try mounting it as a folder? I’ll investigate on my local testing cluster.