Skip to main content
Anubis supports three configuration methods that work together:
  1. Command-line flags - Direct invocation arguments
  2. Environment variables - Uppercase flag names with underscores
  3. Policy files - YAML-based configuration for bot rules and advanced features

Configuration Priority

Settings are applied in this order (highest to lowest priority):
  1. Command-line flags
  2. Environment variables
  3. Default values
Environment variable names are uppercase versions of flag names with hyphens replaced by underscores. For example, --cookie-domain becomes COOKIE_DOMAIN.

Core Configuration Flags

Network and Binding

--bind

Environment: BIND
Default: :8923
Network address for Anubis to listen on.

--bind-network

Environment: BIND_NETWORK
Default: tcp
Network family to bind to. Accepts any value supported by Go’s net.Listen.

--target

Environment: TARGET
Default: http://localhost:3923
URL of the service Anubis should protect and proxy to.

Challenge Configuration

--difficulty

Environment: DIFFICULTY
Default: 4
The number of leading zeroes required in proof-of-work challenge responses. Higher values increase difficulty and client computation time.

Metrics and Health Checks

--metrics-bind

Environment: METRICS_BIND
Default: :9090
Network address for the Prometheus metrics and health check server.
The metrics server exposes two endpoints:
  • GET /metrics - Prometheus metrics
  • GET /healthz - Health check (returns OK when serving)

--metrics-bind-network

Environment: METRICS_BIND_NETWORK
Default: tcp
Network family for the metrics server. Environment: COOKIE_DOMAIN
Default: unset
The domain for which Anubis cookies are valid. Set this to your root domain.
Do not include a port number in COOKIE_DOMAIN. Unlike REDIRECT_DOMAINS, the cookie domain must be a bare domain name.
Environment: COOKIE_DYNAMIC_DOMAIN
Default: false
Automatically set cookie domain based on the request hostname.
You cannot set both COOKIE_DOMAIN and COOKIE_DYNAMIC_DOMAIN at the same time.
Environment: COOKIE_EXPIRATION_TIME
Default: 168h (7 days)
How long challenge pass cookies remain valid.
Environment: COOKIE_PREFIX
Default: anubis-cookie
Prefix for browser cookies created by Anubis. Useful for avoiding conflicts.
This creates cookies named:
  • myapp-anubis-auth
  • myapp-anubis-cookie-verification
Environment: COOKIE_SECURE
Default: true
Enable the Secure flag on cookies, requiring HTTPS.
If using plain HTTP, you must set --cookie-secure=false or cookies will be rejected by browsers.
Environment: COOKIE_SAME_SITE
Default: None
Sets the SameSite attribute for cookies. Valid values: None, Lax, Strict, Default.
If COOKIE_SECURE=false, None is automatically downgraded to Lax. Environment: COOKIE_PARTITIONED
Default: false
Enable the partitioned (CHIPS) flag for iframe isolation.

Policy Files

--policy-fname

Environment: POLICY_FNAME
Default: Built-in policy
Path to the YAML policy file defining bot rules, thresholds, and Open Graph settings.
For details on policy file syntax, see Bot Policies.

Logging

--slog-level

Environment: SLOG_LEVEL
Default: INFO
Log level for structured logging. Valid values: DEBUG, INFO, WARN, ERROR.
Set to DEBUG to see detailed request evaluation information.

Signing Keys

Signing keys are required when using persistent storage backends or running multiple Anubis instances behind the same load balancer.

--ed25519-private-key-hex

Environment: ED25519_PRIVATE_KEY_HEX
Default: Random (generated at startup)
Hex-encoded 64-character ED25519 private key for signing JWTs.
Generate a key:

--ed25519-private-key-hex-file

Environment: ED25519_PRIVATE_KEY_HEX_FILE
Default: unset
Path to a file containing the hex-encoded ED25519 private key.
Only one of --ed25519-private-key-hex or --ed25519-private-key-hex-file may be set.

--hs512-secret

Environment: HS512_SECRET
Default: unset
Secret for JWT HS512 algorithm. If set, ED25519 will not be used.
Cannot be used with ED25519 options.

IP Address Detection

--use-remote-address

Environment: USE_REMOTE_ADDRESS
Default: false
Read the client’s IP from the network socket instead of headers.
Only use this for development or when Anubis directly terminates traffic. In production with a reverse proxy, use X-Real-IP or X-Forwarded-For headers instead.

--custom-real-ip-header

Environment: CUSTOM_REAL_IP_HEADER
Default: unset
Read the client’s real IP from a custom header name.

--xff-strip-private

Environment: XFF_STRIP_PRIVATE
Default: true
Strip private addresses from X-Forwarded-For headers.

JWT Configuration

--jwt-restriction-header

Environment: JWT_RESTRICTION_HEADER
Default: X-Real-IP
Restrict JWT validity to match a specific header value (typically client IP).
The JWT is only valid if the current value of this header matches the value when the JWT was created.

--difficulty-in-jwt

Environment: DIFFICULTY_IN_JWT
Default: false
Include the difficulty level in JWT claims for debugging and statistics.

Path Configuration

--base-prefix

Environment: BASE_PREFIX
Default: unset
Global path prefix for all Anubis endpoints.
With this set:
  • Challenge page: /myapp/ instead of /
  • API endpoints: /myapp/.within.website/x/anubis/...
BASE_PREFIX must start with a slash and must not end with a slash.

--strip-base-prefix

Environment: STRIP_BASE_PREFIX
Default: false
Remove the base prefix when forwarding requests to the target.
Request to /myapp/api/users → forwarded as /api/users

Redirect Configuration

--redirect-domains

Environment: REDIRECT_DOMAINS
Default: unset (same domain only)
Comma-separated list of allowed redirect domains.
See [Redirect Domain Configuration](redirect domains configuration) for details.

--public-url

Environment: PUBLIC_URL
Default: unset
Externally accessible URL for this Anubis instance (used for forwardAuth with Traefik).
Only set this when using forwardAuth mode. Leave unset for sidecar/standalone deployments.

robots.txt

--serve-robots-txt

Environment: SERVE_ROBOTS_TXT
Default: false
Serve a default robots.txt that disallows all AI scrapers and bots.

Unix Socket Configuration

--socket-mode

Environment: SOCKET_MODE
Default: 0770
Permissions (mode) for Unix domain sockets.
Only used when --bind-network=unix or --metrics-bind-network=unix.

Open Graph Configuration

--og-passthrough

Environment: OG_PASSTHROUGH
Default: false
Enable Open Graph tag passthrough for social media previews.
Prefer configuring Open Graph in the [policy file](the policy file) for more control.

--og-expiry-time

Environment: OG_EXPIRY_TIME
Default: 24h
Cache expiration time for Open Graph tags.

--og-cache-consider-host

Environment: OG_CACHE_CONSIDER_HOST
Default: false
Include the hostname in Open Graph cache keys.

Advanced Target Configuration

--target-host

Environment: TARGET_HOST
Default: unset
Override the Host header when forwarding to the target.

--target-sni

Environment: TARGET_SNI
Default: unset
TLS SNI hostname when connecting to HTTPS backends.

--target-insecure-skip-verify

Environment: TARGET_INSECURE_SKIP_VERIFY
Default: false
Skip TLS certificate validation for HTTPS backends.
Only use this for development. Never skip TLS verification in production.

--target-disable-keepalive

Environment: TARGET_DISABLE_KEEPALIVE
Default: false
Disable HTTP keep-alive for backend connections.

User Interface Customization

--webmaster-email

Environment: WEBMASTER_EMAIL
Default: unset
Display a contact email on error pages.

--use-simplified-explanation

Environment: USE_SIMPLIFIED_EXPLANATION
Default: false
Use simplified language in “Why am I seeing this?” text for non-technical users.

--forced-language

Environment: FORCED_LANGUAGE
Default: unset
Force a specific language instead of using the browser’s Accept-Language header.
Use ISO 639-1 language codes.

Utility Flags

--version

Environment: N/A Print Anubis version and exit.

--healthcheck

Environment: N/A Run a health check against the running Anubis instance.
Exits with code 0 if healthy, non-zero otherwise.

--extract-resources

Environment: EXTRACT_RESOURCES
Default: unset
Extract embedded static resources to a directory.

--debug-benchmark-js

Environment: DEBUG_BENCHMARK_JS
Default: false
Enable debug mode that shows challenges on every request for testing JavaScript performance.
This is a debug tool only. Every request will receive a challenge, blocking all traffic. Use only for benchmarking client-side challenge performance.

Configuration via Policy Files

The following settings are configured in the YAML policy file rather than via flags:
  • Bot detection rules - Define which bots to block, challenge, or allow
  • Open Graph passthrough - Advanced social media preview configuration
  • Weight thresholds - Custom scoring thresholds for bot detection
See the following documentation for policy file configuration:

Bot Policies

Configure bot detection rules

Policy Configuration

Complete policy file structure

Environment Variable Examples

Next Steps

Bot Policies

Configure bot detection rules

Deployment Guides

Platform-specific setup guides