Skip to main content
Anubis uses proof-of-work challenges to distinguish legitimate browsers from bots. This page covers challenge difficulty settings and available challenge methods.

Challenge Settings

Challenges can be configured globally (via command-line flags) or per-rule (in the policy file).

Global Configuration

Default difficulty: 2

Per-Rule Configuration

Challenge Parameters

Difficulty

Difficulty controls the number of leading zero bits required in the proof-of-work hash. Valid range: 0 to 64
  • Too low (< 0): ErrChallengeDifficultyTooLow
  • Too high (> 64): ErrChallengeDifficultyTooHigh
Solve times are approximate and depend on client device performance.

Algorithm

Anubis supports multiple challenge algorithms: Default: fast

Challenge Methods

SHA-256 proof-of-work challenge using WebCrypto API:
Advantages:
  • Fast client-side computation
  • No external dependencies
  • Works in all modern browsers
Requirements:
  • JavaScript enabled
  • WebCrypto API support (all modern browsers)

Meta Refresh

HTML-only challenge using <meta http-equiv="refresh">:
Advantages:
  • No JavaScript required
  • Works in text browsers (lynx, w3m)
  • Accessible to screen readers
Limitations:
  • Lower difficulty only (recommend difficulty: 1)
  • Slower user experience
  • Cannot use client-side computation
Use cases:
  • Accessibility requirements
  • JavaScript-disabled environments
  • Low-suspicion traffic

Preact

React-based UI with visual feedback:
Advantages:
  • Better user experience
  • Progress indicators
  • Error handling UI
Requirements:
  • Modern JavaScript support
  • Same as fast algorithm

Slow (Deprecated)

Legacy algorithm. Use fast instead:
Anubis will log a warning if slow is detected. Update to fast when possible.

Challenge Configuration Examples

Lightweight Protection

Standard Protection

Heavy Protection

Graduated Protection with Weights

Custom Status Codes

By default, challenges return HTTP 200 to deceive scrapers. You can customize this:
Valid range: 100-599

Challenge Cookies

Successful challenge solutions are stored in cookies:
Cookies are prefixed (default: anubis):

JWT Signing

Challenge solutions are signed with Ed25519 or HMAC-SHA512. See Security for key configuration.

Validation

Common configuration errors:

Missing Algorithm

Fix: Always specify algorithm:

Invalid Difficulty

Fix: Use difficulty between 0-64:

CHALLENGE without Challenge Config

Fix: Either set global default or specify per-rule:

Performance Considerations

Client-Side

  • Difficulty 2: ~200ms on modern devices
  • Difficulty 4: ~1s on modern devices, ~5s on older devices
  • Difficulty 8+: May timeout on mobile devices

Server-Side

Challenges are stateless and require no server computation. Server load comes from:
  • Challenge page delivery (minimal)
  • JWT verification (fast)
  • Storage backend operations (depends on backend)

Testing Challenges

Test challenge configuration without blocking traffic:
This bypasses all rules and presents challenges to every request.

Next Steps