Options
All
  • Public
  • Public/Protected
  • All
Menu

Options for the proxy method

Hierarchy

  • ProxyOptions

Index

Properties

Optional headers

headers: undefined | {}

Additional headers to send upstream

Optional path

path: string | (() => string | undefined)

The path for the URL to request from the upstream site. You can reference variables captured by the route pattern using :variable.

Example

 new Router()
   .get('/some/path/with/:variable', ({ proxy }) => {
     proxy('legacy', { path: '/some/other/path/with/:variable' })
   })

Path can also be a function that returns a URL path string, in which case it will be computed in the cloud rather than at build time.

Optional transformRequest

transformRequest: undefined | ((request: Request) => void)

A function that transforms the request before it is sent to the upstream server. In general, this is used to alter the request headers or body based on some conditional logic.

Optional transformResponse

transformResponse: undefined | ((response: Response, request: Request) => void)

A function that transforms the response before it is returned to the browser. This function typically alters response.body to change the content sent to the browser. It can also add, remove, and alter response headers.

Generated using TypeDoc