auth_digest_replays

The auth_digest_replays directive configures the maximum allowed replay attempts for Digest Authentication in NGINX.

Syntaxauth_digest_replays number;
Default20
Contexthttp, server, location
Arguments1

Description

The auth_digest_replays directive is part of the Digest Authentication module for NGINX, which provides a way to secure HTTP requests through a challenge-response mechanism using hashing. This directive specifies how many times a given nonce, or authentication token, can be replayed by a client. Setting this value helps to mitigate replay attacks, where an attacker tries to resend valid authentication tokens to gain access to restricted areas of the application.

When a request is received, the NGINX server checks the nonce provided by the client against the server's stored nonces. If the same nonce is reused more often than the configured limit (defined by auth_digest_replays), NGINX considers the request potentially malicious and may reject it based on its defined security policies. This adds an essential layer of security to your applications, especially in environments where sensitive data is being transmitted.

To implement this directive effectively, configure it in the http, server, or location contexts. The parameter is an integer value that specifies the maximum number of allowed replays for a nonce. If the value is set too high, it may weaken security by allowing more replay attempts; if set too low, it may impede legitimate users who may need to authenticate multiple times due to network issues or other interruptions.

Config Example

http {
    ...
    auth_digest_replays 10;
    ...
}

Setting auth_digest_replays too high may expose your application to replay attacks.

Setting it too low can prevent legitimate users from successfully authenticating if they attempt to resend requests.

← Back to all directives