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 dropped automatically, the remaining header fields will be sent upstream.
The response body is written into fit://request/content/main
where it
can be directly accessed with the body
or the
content
function.
Additional information about the response, such as headers and status code can
be found in the $upstream
variable.
Just like an ordinary request
the proxy-request
can be configured using a JSON template
with the following properties:
Sets the URL to the upstream system. Required.
Sets or removes request header fields. The syntax is the same as in the request action.
To remove a header, set its value to ""
.
Sets request options. See the request
action options for valid options.
<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>