Skip to main content

dns_rebinding_guard

Function dns_rebinding_guard 

Source
pub async fn dns_rebinding_guard(
    request: Request,
    next: Next,
) -> Result<Response, StatusCode>
Expand description

Axum middleware that blocks DNS rebinding attacks.

Rejects any request where the Host header is not a localhost address.

§Errors

Returns StatusCode::FORBIDDEN if the Host header is not localhost, 127.0.0.1, or ::1.