Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 1.55 KB

File metadata and controls

58 lines (41 loc) · 1.55 KB

proxy-request Action

The proxy-request action forwards the incoming request almost unmodified to an upstream system.

The HTTP method and the request body are taken as-is from the client request. Cookie, Authorization and any hop-by-hop header fields like Connection will be automatically dropped.

The response body is written into fit://request/content/main where it can be directly accessed with the content() function. Additional information about the response, such as headers and status code can be found in the $upstream variable.

Usage

Just like an ordinary request the proxy-request can be configured using a JSON template with the following properties:

url

Sets the URL to the upstream system.

headers

Sets the request headers. The syntax is the same as in the request action.

options

Sets request options. See the request action options for valid options.

Example

<flow>
  <proxy-request>
  {
    "url": "https://example.com/api/",

    "headers": {
      "X-API-Key": "foo42bar"
    },

    "options": {
      "exit-on-error": true,
      "definition": "upstream.yaml",
      "validate-request": true,
      "validate-response": true
    }
  }
  </proxy-request>
</flow>

See also