HTTP Request
Overview
The HTTP Request Traffic Policy action performs an outbound HTTP request to a target URL. You can use it to integrate with external services through internal endpoints or—if enabled—with external APIs.
Note: External requests are supported but disabled by default. Contact ngrok support to enable external access.
Configuration Reference
The Traffic Policy configuration reference for this action.
Supported Phases
on_http_request
, on_http_response
Type
http-request
Configuration Fields
urlstringRequiredCEL
The destination URL for the HTTP request.
methodenum
The HTTP method to use for the request.
- Possible enum values
GET
(default)PUT
POST
PATCH
DELETE
OPTIONS
query_paramslist of objectsCEL
A list of query parameters to append to the URL. Each item is an object with the following structure:
Loading…
This format supports CEL interpolation in both keys and values.
Maximum:
32
entries. Key max length:128
chars. Value max length:8192
chars.headersobjectCEL
A map of HTTP headers to include in the request. Keys are header names and values are header values.
Maximum:
10
entries.bodystringCEL
The body of the HTTP request. Supported on methods like
POST
,PUT
, orPATCH
.max_redirectsint
The maximum number of HTTP redirects to follow.
Default is
10
. The minimum allowed is0
. The maximum allowed is100
.timeoutduration
The maximum duration as a duration string to wait for the entire request (including retries and redirects).
Default is
3s
. The minimum allowed is1s
. The maximum allowed is30s
.retry_conditionstringCEL
A CEL expression evaluated after each failed attempt. If
true
, the request is retried (up to3
times).- Supported retry variables
attempts
(int
): Total number of attempts so farlast_attempt.req
: The last request objectlast_attempt.res
: The last response object (if any)last_attempt.error
: The error string (if any)
Default:
false
on_errorenum
Determines how to proceed if the HTTP request fails.
- Possible enum values
continue
(default) – Proceed with remaining actionshalt
– Stop processing the policy
Action Result Variables
The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.
actions.ngrok.http_request.error.codestring
actions.ngrok.http_request.error.messagestring
Message for an error that occurred during the invocation of an action.
actions.ngrok.http_request.attemptsarray of objects
A list of HTTP responses for each request attempt.
actions.ngrok.http_request.reqobject
The HTTP request.
actions.ngrok.http_request.resobject
The last attempted HTTP response. Unlike
actions.ngrok.attempts[i]
this variable also contains the response body.