Deny
Overview
The Deny Traffic Policy action enables you to reject incoming requests on your endpoints before they make it to your upstream service.
status_codeinteger
Response status code. Default is
999
.
When this action is executed, the upstream server is never reached and a response is immediately returned and no further actions or rules in the policy configuration will be executed.
Custom Content
The deny traffic policy action will not send back a response body to the client.
To send back a response body, use the custom-response
action.
Deny traffic with a 404 status code
The following Traffic Policy
configuration will deny all inbound traffic with a 404
on your endpoint.
Example Traffic Policy Document
- YAML
- JSON
---
on_http_request:
- actions:
- type: "deny"
config:
status_code: 404
{
"on_http_request": [
{
"actions": [
{
"type": "deny",
"config": {
"status_code": 404
}
}
]
}
]
}
Example Request
$ curl https://example.ngrok.app
HTTP/2 404 Not Found
In this example, we attempt to connect to example.ngrok.app
using the
curl
command and ngrok immediately closes the connection with a 404
status
code.
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.
This action does not set any variables after it has been executed.