Options for the proxy method

Hierarchy

  • ProxyOptions

Properties

followRedirects?: boolean

When is set to true, the proxy method will follow redirects and return the final response. All redirect locations which are absolute URLs need to be setup in hostnames section of the edgio.config.js and have configured origin otherwise the default origin will be used. Due to security policy is not possible to share cookie and authorization headers between different hostnames.

Default

false

headers?: {
    [key: string]: string;
}

Additional headers to send upstream

Type declaration

  • [key: string]: string
path?: string | (() => undefined | string)

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.

removeEmptySearchParamValues?: boolean

Removes the "=" from search parameters that have no value. So for example: "http://domain.com?foo=&bar=" becomes "http://domain.com?foo&bar"

transformRequest?: ((request: default) => void | Promise<void>)

Type declaration

    • (request: default): void | Promise<void>
    • A function that transforms the request before it is sent to the origin server. In general, this is used to alter the request headers or body based on some conditional logic. Note that code in this method will be executed using Edgio Cloud Functions and not at the edge.

      Parameters

      Returns void | Promise<void>

transformResponse?: ((response: default, request: default) => void | Promise<void>)

Type declaration

    • (response: default, request: default): void | Promise<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. Note that code in this method will be executed using Edgio Cloud Functions and not at the edge.

      Parameters

      Returns void | Promise<void>

Generated using TypeDoc