import type { IncomingMessage } from 'node:http'; import type { Socket } from 'node:net'; import type { SiteShareRecord } from './site-share-types.js'; import type { SiteShareStore } from './site-share-store.js'; export interface ProxyRequestContext { /** Path inside the share to forward (no leading basePrefix). */ innerPath: string; /** Path prefix the share is mounted under (used for Set-Cookie/Location rewrite). For subdomain mode use ''. */ basePrefix: string; /** Client IP for forwarded headers and audit. */ clientIp: string; /** Full request URL (for forwarded proto). */ originalUrl: URL; /** Whether the request reached us via HTTPS at the edge. */ forwardedProto: 'http' | 'https'; } export interface ProxyResult { response: Response; } /** * Forward an HTTP request to the upstream and return a streaming Response. * Handles header filtering, forwarded headers, Set-Cookie / Location rewriting, * and a per-request timeout. */ export declare function forwardHttpRequest(record: SiteShareRecord, store: SiteShareStore, req: Request, ctx: ProxyRequestContext): Promise; export declare function handleProxyWebSocketUpgrade(args: { record: SiteShareRecord; store: SiteShareStore; req: IncomingMessage; socket: Socket; head: Buffer; innerPath: string; basePrefix: string; clientIp: string; }): void;