UNPKG

@push.rocks/smartproxy

Version:

A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.

41 lines (40 loc) 1.86 kB
import * as plugins from '../../plugins.js'; import '../../core/models/socket-augmentation.js'; import type { IHttpRouteContext } from '../../core/models/route-context.js'; import type { ILogger } from './models/types.js'; import type { IMetricsTracker } from './request-handler.js'; import type { IRouteConfig } from '../smart-proxy/models/route-types.js'; /** * HTTP Request Handler Helper - handles requests with specific destinations * This is a helper class for the main RequestHandler */ export declare class HttpRequestHandler { /** * Handle HTTP request with a specific destination */ static handleHttpRequestWithDestination(req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse, destination: { host: string; port: number; }, routeContext: IHttpRouteContext, startTime: number, logger: ILogger, metricsTracker?: IMetricsTracker | null, route?: IRouteConfig): Promise<void>; /** * Apply URL rewriting based on route configuration * Implements Phase 5.2: URL rewriting using route context * * @param req The request with the URL to rewrite * @param route The route configuration containing rewrite rules * @param routeContext Context for template variable resolution * @param logger Logger for debugging information * @returns True if URL was rewritten, false otherwise */ private static applyUrlRewriting; /** * Apply header modifications from route configuration to request headers * Implements Phase 5.1: Route-based header manipulation for requests */ private static applyRouteHeaderModifications; /** * Apply header modifications from route configuration to response headers * Implements Phase 5.1: Route-based header manipulation for responses */ private static applyResponseHeaderModifications; }