Overview
Thelib.Options struct contains configuration parameters for initializing an Anubis server instance. These options control middleware behavior, security settings, cookie configuration, and integration with upstream services.
Type Definition
Fields
http.Handler
HTTP handler to call after successful bot protection validation. This is typically your application’s main handler.
*policy.ParsedConfig
required
Parsed bot policy configuration containing bot rules, thresholds, and challenge settings.
string
Target URL for reverse proxy mode. When set, Anubis acts as a reverse proxy to this upstream server.
string
Override the Host header when proxying requests to the target.
string
SNI (Server Name Indication) value to use when connecting to the target over TLS.
bool
default:"false"
Skip TLS certificate verification when connecting to the target. Only use in development environments.
bool
default:"false"
Enable dynamic cookie domain based on the request hostname.
string
Domain attribute for authentication cookies. If empty, cookies are scoped to the current domain.
time.Duration
default:"24h"
Duration until authentication cookies expire.
bool
default:"false"
Enable partitioned cookies (CHIPS) for improved privacy in third-party contexts.
string
default:"/"
URL path prefix for all Anubis endpoints. Useful when mounting Anubis under a specific path.
string
Contact email address displayed to users who are blocked or challenged.
[]string
List of allowed domains for redirect validation to prevent open redirect vulnerabilities.
ed25519.PrivateKey
Ed25519 private key for signing JWTs. Auto-generated if both this and HS512Secret are nil.
[]byte
HMAC-SHA512 secret for signing JWTs. Used instead of ED25519PrivateKey when set.
bool
default:"false"
Remove the BasePrefix from requests before proxying to the target.
config.OpenGraph
OpenGraph tag configuration for customizing social media previews.
bool
default:"false"
Serve a robots.txt file at
/robots.txt and /.well-known/robots.txt.bool
default:"true"
Set the Secure flag on authentication cookies, requiring HTTPS.
http.SameSite
default:"http.SameSiteLaxMode"
SameSite attribute for authentication cookies. Valid values:
http.SameSiteDefaultMode, http.SameSiteLaxMode, http.SameSiteStrictMode, http.SameSiteNoneMode.*slog.Logger
Structured logger instance. If nil, a default logger is created with subsystem=“anubis”.
string
default:"info"
Logging level. Valid values:
debug, info, warn, error.string
Public-facing URL of the Anubis service. Used for generating absolute URLs in responses.
string
HTTP header name to check for JWT-based restrictions. When set, enables header-based authentication.
bool
default:"false"
Include challenge difficulty in JWT claims for verification.
Related Types
- config.OpenGraph - OpenGraph configuration
- policy.ParsedConfig - Parsed policy configuration