Module request_handler

Module request_handler 

Source
Expand description

HTTP request handling and proxying.

This module contains the core request handling logic for the reverse proxy, including IP validation, rate limiting, URL pattern blocking, and request forwarding.

§Architecture

The request handling flow:

  1. Extract and validate client IP from proxy headers
  2. Check if IP is blocked
  3. Check for blocked URL patterns
  4. Check for blocked HTTP methods
  5. Apply rate limiting
  6. Forward request to upstream service

§Connection Pooling

The module accepts a shared reqwest::Client for HTTP connection pooling, which should be configured by the caller with appropriate timeouts.

Functions§

create_error_response
Creates a standardized error response.
create_unauthorized_response
Creates a 401 Unauthorized response with WWW-Authenticate header.
handle_request
Handles an incoming HTTP request through the proxy pipeline.