Deployment Architecture
The typical deployment flow looks like this:IP Address Forwarding
Anubis needs to know the real client IP address to enforce rate limits and detect malicious behavior. Reverse proxies communicate the client IP using standard headers:X-Real-IP Header
TheX-Real-IP header contains the client’s IP address. Anubis reads this header to determine the source of the request.
X-Forwarded-For Header
TheX-Forwarded-For header contains a chain of IP addresses representing the request’s path through multiple proxies:
- Strips private addresses when
--xff-strip-privateis enabled (default: true) - Flattens the chain to extract the first public IP
- Sets X-Real-IP from X-Forwarded-For if X-Real-IP is not already set
Private Address Stripping
By default, Anubis strips these address ranges from X-Forwarded-For:- Private addresses: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
- Loopback addresses: 127.0.0.0/8, ::1
- CGNAT addresses: 100.64.0.0/10
- Link-local addresses: 169.254.0.0/16, fe80::/10
Deployment Modes
Reverse Proxy Mode (Default)
In this mode, Anubis forwards validated traffic to a backend application:Forward Auth Mode
In this mode, Anubis only validates requests without proxying:- Sends requests to
/.within.website/x/cmd/anubis/api/check - Anubis returns 200 if validated, 401 if challenge required
- On 401, redirect user to Anubis challenge page
Configuration Flags
—use-remote-address
When running Anubis directly exposed to the internet (not behind a proxy), use this flag to read the client IP from the network socket:—custom-real-ip-header
Some environments use custom headers for the client IP:—xff-strip-private
Controls whether private addresses are stripped from X-Forwarded-For (default: true):Proxy Configuration Requirements
Your reverse proxy must:- Set X-Real-IP header to the client’s IP address
- Preserve or set X-Forwarded-For header with the client IP
- Set Host header to the original request’s host
- Forward protocol information if needed (X-Forwarded-Proto for HTTPS detection)
Health Checks
Anubis exposes health check endpoints:- Main health:
http://localhost:9090/healthz(configurable with--metrics-bind) - Prometheus metrics:
http://localhost:9090/metrics