Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Server

Index

Constructors

  • Creates the proxy server with specified options.

    Parameters

    • Optional options: ServerOptions

      Config object passed to the proxy

    Returns Server

Methods

  • addListener(event: string, listener: () => void): Server
  • Parameters

    • event: string
    • listener: () => void
        • (): void
        • Returns void

    Returns Server

  • close(callback?: () => void): void
  • A function that closes the inner webserver and stops listening on given port

    Parameters

    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

  • emit(event: string, ...args: any[]): boolean
  • Parameters

    • event: string
    • Rest ...args: any[]

    Returns boolean

  • getMaxListeners(): number
  • Returns number

  • A function that wraps the object in a webserver, for your convenience

    Parameters

    • port: number

      Port to listen on

    Returns Server

  • listenerCount(type: string): number
  • Parameters

    • type: string

    Returns number

  • listeners(event: string): (() => void)[]
  • Parameters

    • event: string

    Returns (() => void)[]

  • on(event: string, listener: () => void): Server
  • on(event: "error", listener: ErrorCallback): Server
  • on(event: "start", listener: (req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl) => void): Server
  • on(event: "proxyReq", listener: (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse<IncomingMessage>, options: ServerOptions) => void): Server
  • on(event: "proxyRes", listener: (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse<IncomingMessage>) => void): Server
  • on(event: "proxyReqWs", listener: (proxyReq: ClientRequest, req: IncomingMessage, socket: Socket, options: ServerOptions, head: any) => void): Server
  • on(event: "econnreset", listener: (err: Error, req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl) => void): Server
  • on(event: "end", listener: (req: IncomingMessage, res: ServerResponse<IncomingMessage>, proxyRes: IncomingMessage) => void): Server
  • on(event: "close", listener: (proxyRes: IncomingMessage, proxySocket: Socket, proxyHead: any) => void): Server
  • Parameters

    • event: string
    • listener: () => void
        • (): void
        • Returns void

    Returns Server

  • Parameters

    Returns Server

  • Parameters

    • event: "start"
    • listener: (req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl) => void
        • (req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl): void
        • Parameters

          • req: IncomingMessage
          • res: ServerResponse<IncomingMessage>
          • target: ProxyTargetUrl

          Returns void

    Returns Server

  • Parameters

    • event: "proxyReq"
    • listener: (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse<IncomingMessage>, options: ServerOptions) => void
        • (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse<IncomingMessage>, options: ServerOptions): void
        • Parameters

          • proxyReq: ClientRequest
          • req: IncomingMessage
          • res: ServerResponse<IncomingMessage>
          • options: ServerOptions

          Returns void

    Returns Server

  • Parameters

    • event: "proxyRes"
    • listener: (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse<IncomingMessage>) => void
        • (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse<IncomingMessage>): void
        • Parameters

          • proxyRes: IncomingMessage
          • req: IncomingMessage
          • res: ServerResponse<IncomingMessage>

          Returns void

    Returns Server

  • Parameters

    • event: "proxyReqWs"
    • listener: (proxyReq: ClientRequest, req: IncomingMessage, socket: Socket, options: ServerOptions, head: any) => void
        • (proxyReq: ClientRequest, req: IncomingMessage, socket: Socket, options: ServerOptions, head: any): void
        • Parameters

          • proxyReq: ClientRequest
          • req: IncomingMessage
          • socket: Socket
          • options: ServerOptions
          • head: any

          Returns void

    Returns Server

  • Parameters

    • event: "econnreset"
    • listener: (err: Error, req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl) => void
        • (err: Error, req: IncomingMessage, res: ServerResponse<IncomingMessage>, target: ProxyTargetUrl): void
        • Parameters

          • err: Error
          • req: IncomingMessage
          • res: ServerResponse<IncomingMessage>
          • target: ProxyTargetUrl

          Returns void

    Returns Server

  • Parameters

    • event: "end"
    • listener: (req: IncomingMessage, res: ServerResponse<IncomingMessage>, proxyRes: IncomingMessage) => void
        • (req: IncomingMessage, res: ServerResponse<IncomingMessage>, proxyRes: IncomingMessage): void
        • Parameters

          • req: IncomingMessage
          • res: ServerResponse<IncomingMessage>
          • proxyRes: IncomingMessage

          Returns void

    Returns Server

  • Parameters

    • event: "close"
    • listener: (proxyRes: IncomingMessage, proxySocket: Socket, proxyHead: any) => void
        • (proxyRes: IncomingMessage, proxySocket: Socket, proxyHead: any): void
        • Parameters

          • proxyRes: IncomingMessage
          • proxySocket: Socket
          • proxyHead: any

          Returns void

    Returns Server

  • once(event: string, listener: () => void): Server
  • Parameters

    • event: string
    • listener: () => void
        • (): void
        • Returns void

    Returns Server

  • removeAllListeners(event?: string): Server
  • Parameters

    • Optional event: string

    Returns Server

  • removeListener(event: string, listener: () => void): Server
  • Parameters

    • event: string
    • listener: () => void
        • (): void
        • Returns void

    Returns Server

  • setMaxListeners(n: number): Server
  • Parameters

    • n: number

    Returns Server

  • Used for proxying regular HTTP(S) requests

    Parameters

    • req: IncomingMessage

      Client request.

    • res: ServerResponse<IncomingMessage>

      Client response.

    • Optional options: ServerOptions

      Additional options.

    • Optional callback: ErrorCallback

    Returns void

  • Used for proxying regular HTTP(S) requests

    Parameters

    • req: IncomingMessage

      Client request.

    • socket: unknown

      Client socket.

    • head: unknown

      Client head.

    • Optional options: ServerOptions

      Additional options.

    • Optional callback: ErrorCallback

    Returns void

  • Creates the proxy server with specified options.

    Parameters

    • Optional options: ServerOptions

      Config object passed to the proxy

    Returns Server

    Proxy object with handlers for ws and web requests

  • Creates the proxy server with specified options.

    Parameters

    • Optional options: ServerOptions

      Config object passed to the proxy

    Returns Server

    Proxy object with handlers for ws and web requests

  • Creates the proxy server with specified options.

    Parameters

    • Optional options: ServerOptions

      Config object passed to the proxy

    Returns Server

    Proxy object with handlers for ws and web requests