UNPKG

@specprotected/spec-proxy-fastly-worker

Version:

Spec Proxy implementation for Fastly Compute@Edge Workers

17 lines (16 loc) 816 B
import * as spec from "@specprotected/spec-proxy-service-worker"; export interface HostReplacement { find: string; replace: string; regex: boolean; } export interface SpecConfiguration extends spec.SpecConfiguration { dynamicBackends?: boolean; alternateHostHeader?: string; hostReplacements?: [HostReplacement]; } export declare function setFastlyBackends(map: Record<string, string>): void; export declare function addFastlyBackend(host: string, backend: string): void; export declare function specProxyProcessRequest(event: FetchEvent, config?: spec.SpecConfiguration): Request; export declare function specProxyProcessResponse(request: Request, response: Response): Response; export declare function specProxyProcess(event: FetchEvent, config: spec.SpecConfiguration): Promise<Response>;