Deployment

laravel-rust-captcha Alpha Laravel for Rust

Input middleware

Set the exceptions for both input normalizers in the application's final with_middleware callback. Include the fields other providers need alongside the captcha's configured answer and key fields.

use laravel_rust_captcha::CaptchaServiceProvider;

Application::configure().with_middleware(|middleware, config| {
    CaptchaServiceProvider::configure_input(middleware, config, &["password_confirmation"]);
});

If trimming and empty-to-null conversion need different app exceptions, supply their lists separately with TrimStrings::except and ConvertEmptyStringsToNull::except. Include the captcha fields in both. The app checks the global replacements at boot. Apply the same exceptions to any additional normalizers you install in other parts of the stack.

The challenge store

Challenges live in a cache store (CAPTCHA_STORE, or the default store). Every process that serves your app must see the same store, or an answer can be checked against a process that never issued it, and "one pass per challenge" can't hold.

StoreIn production
redisRecommended. Requires CAPTCHA_TRUST_STORE=true.
database (Postgres, MySQL)Requires CAPTCHA_TRUST_STORE=true. Enable the captcha crate's database feature and use a writer-only connection. Checks use another pooled connection, outside your transaction.
database (SQLite)Requires CAPTCHA_TRUST_STORE=true. Enable database if the app already enables Laravel's SQLite driver, or use database-sqlite to enable both. Give the captcha store a separate file. Boot compares the effective filenames, including across connection aliases.
CustomRequires CAPTCHA_TRUST_STORE=true. The driver must provide atomic add, increment, decrement and forget. forget must report whether it removed a live value.
memoryRefused, unless CAPTCHA_SINGLE_PROCESS=true: each process has its own memory.
failoverRefused: it can answer different operations from different stores.
discardRefused: it keeps nothing, so every check would fail.

Laravel for Rust 0.2 lets an app replace a driver factory under a built-in name. Verify that the resolved backend is shared and provides the atomic operations above before setting CAPTCHA_TRUST_STORE=true for any production shared store. The app stops at boot if the store is refused.

Transactions

The captcha's reads and writes never join a database transaction you have open. A check inside a transaction that rolls back still counts the attempt, so a failing form can't hand out free guesses.

Limits

LimitDefaultSetting
Images per client per clock minute (both routes and issue)30CAPTCHA_THROTTLE
Wrong answers per client and profile per clock minute10CAPTCHA_FAILURE_LIMIT
Images drawn at onceCPU countCAPTCHA_MAX_RENDERS
Wait for a free renderer1 second, then 503
Wait for the entire check2 seconds, then the check fails closed

Both limits use the challenge store. Each fixed window admits at most N image requests per client per clock minute across profiles, and at most N wrong answers per client and profile per clock minute. Keep clocks synchronized across application processes that share the store.

Caching and proxies

Both routes send Cache-Control: no-store. Don't cache them in a CDN: every request must reach the app to issue a new challenge.

Key rotation

Answers are checked against the current APP_KEY and every key in APP_PREVIOUS_KEYS, so rotating the key doesn't break challenges that are open.