Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

policy_engine: rename inbound/outbound to new phase names #955

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions docs/agent/config/v2.mdx

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions docs/agent/config/v3.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/guides/device-gateway/arm64.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Now that you have SSH tunneling and service ingress handled via ngrok, you may a

```yaml
---
inbound:
on_tcp_connect:
- actions:
- name: "Restrict all IPs except trusted CIDRs"
type: "restrict-ips"
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/device-gateway/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ the request:
"protocol": "http",
"forwards_to": "localhost:8001",
"domain": "device123.sitea.configurable-domain.com",
"policy": "{\"inbound\": [], \"outbound\": [{\"expressions\": [], \"name\": \"Add headers to requests\", \"actions\": [{\"type\": \"add-headers\", \"config\": {\"headers\": {\"is-ngrok\": \"0000000000\"}}}]}]}"
"policy": "{\"on_http_request\": [], \"on_http_response\": [{\"expressions\": [], \"name\": \"Add headers to requests\", \"actions\": [{\"type\": \"add-headers\", \"config\": {\"headers\": {\"is-ngrok\": \"0000000000\"}}}]}]}"
}
]
```
Expand All @@ -293,7 +293,7 @@ curl -k \
-X POST \
-H "Content-Type: application/json" \
-d '{"protocol": "http", "forwards_to": "{HOST}:{PORT}","domain":"{YOUR_DOMAIN}", "policy": \
{"inbound":[],"outbound":[{"expressions":[],"name":"Add headers to requests","actions":[{"type":"add-headers","config":{"headers":{"is-ngrok":"444"}}}]}]}}' \
{"on_http_request":[],"on_http_response":[{"expressions":[],"name":"Add headers to requests","actions":[{"type":"add-headers","config":{"headers":{"is-ngrok":"444"}}}]}]}}' \
https://{YOUR_AGENT_DOMAIN}/tunnels
```

Expand All @@ -306,8 +306,8 @@ You should receive a `200` response similar to the following:
"forwards_to": "localhost:8001",
"domain": "device123.sitea.configurable-domain.com",
"policy": {
"inbound": [],
"outbound": [
"on_http_request": [],
"on_http_response": [
{
"expressions": [],
"name": "Add headers to requests",
Expand Down
26 changes: 13 additions & 13 deletions docs/http/traffic-policy/actions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ pagination_label: Actions

Traffic Policy actions enable you to modify the behavior of traffic flowing through your endpoints. The following actions are available for use on your endpoints:

| Type | Description | Supported On |
| -------------------------------------- | --------------------------------------------------------------------- | ----------------- |
| [add-headers](add-headers) | Add custom headers to incoming requests or outgoing responses. | Inbound, Outbound |
| [compress-response](compress-response) | Compress HTTP response bodies from your upstream server. | Inbound, Outbound |
| [custom-response](custom-response) | Send a predefined custom response directly to the client. | Inbound, Outbound |
| [deny](deny) | Block incoming traffic to an endpoint. | Inbound |
| [jwt-validation](jwt-validation) | Validate JSON Web Tokens (JWT). | Inbound |
| [log](log) | Add metadata to events for logging and monitoring. | Inbound, Outbound |
| [rate-limit](rate-limit) | Rate limit traffic to your upstream servers. | Inbound |
| [redirect](redirect) | Redirect users through URL transformations using regular expressions. | Inbound |
| [remove-headers](remove-headers) | Remove headers from incoming requests or outgoing responses. | Inbound, Outbound |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | Inbound |
| [url-rewrite](url-rewrite) | Rewrite request URLs transparently using regular expressions. | Inbound |
| Type | Description | Supported On |
| -------------------------------------- | --------------------------------------------------------------------- | --------------------------------- |
| [add-headers](add-headers) | Add custom headers to incoming requests or outgoing responses. | on_http_request, on_http_response |
| [compress-response](compress-response) | Compress HTTP response bodies from your upstream server. | on_http_request, on_http_response |
| [custom-response](custom-response) | Send a predefined custom response directly to the client. | on_http_request, on_http_response |
| [deny](deny) | Block incoming traffic to an endpoint. | on_http_request |
| [jwt-validation](jwt-validation) | Validate JSON Web Tokens (JWT). | on_http_request |
| [log](log) | Add metadata to events for logging and monitoring. | on_http_request, on_http_response |
| [rate-limit](rate-limit) | Rate limit traffic to your upstream servers. | on_http_request |
| [redirect](redirect) | Redirect users through URL transformations using regular expressions. | on_http_request |
| [remove-headers](remove-headers) | Remove headers from incoming requests or outgoing responses. | on_http_request, on_http_response |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | on_http_request |
| [url-rewrite](url-rewrite) | Rewrite request URLs transparently using regular expressions. | on_http_request |
24 changes: 12 additions & 12 deletions docs/http/traffic-policy/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import TrafficPolicyWarning from "/shared/warnings/traffic-policy-preview.mdx";
## Overview

This module allows you to assign a policy to your endpoints containing a series
of inbound and outbound rules that can be used to influence and control traffic
of `on_http_request` and `on_http_response` rules that can be used to influence and control traffic
to and from your upstream service.

Policy rules are composed of expressions that filter the traffic on which they are applicable
Expand Down Expand Up @@ -60,8 +60,8 @@ and actions that should take effect.

## Behavior

Policy rules are evaluated sequentially in the order they are configured with inbound rules taking effect before the
upstream server is reached and outbound rules taking effect after the upstream server responds. Whether or not the configured
Policy rules are evaluated sequentially in the order they are configured with `on_http_request` rules taking effect before the
upstream server is reached and `on_http_response` rules taking effect after the upstream server responds. Whether or not the configured
actions are performed is determined at runtime by the expressions.

### Expression Evaluation
Expand All @@ -86,15 +86,15 @@ See [actions](./actions) for all available actions.

### Configuration

| Parameter | Description |
| --------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **inbound** | A list of policy rules that will be applied to inbound traffic in the order specified. |
| **outbound** | A list of policy rules that will be applied to outbound traffic in the order specified. |
| **name** | Policy rules can optionally be given a name for convenience. |
| **expressions** | A list of CEL expressions that filter which traffic a policy rule will apply to. |
| **actions** | A list of actions that will execute sequentially if the associated policy rule's expressions all match on the traffic. |
| **type** | The type of action. |
| **config** | The configuration details of how an action should execute. Each action has its own configuration structure. |
| Parameter | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **on_http_request** | A list of policy rules that will be applied to inbound http traffic in the order specified. |
| **on_http_response** | A list of policy rules that will be applied to outbound http traffic in the order specified. |
| **name** | Policy rules can optionally be given a name for convenience. |
| **expressions** | A list of CEL expressions that filter which traffic a policy rule will apply to. |
| **actions** | A list of actions that will execute sequentially if the associated policy rule's expressions all match on the traffic. |
| **type** | The type of action. |
| **config** | The configuration details of how an action should execute. Each action has its own configuration structure. |

## Edges

Expand Down
6 changes: 3 additions & 3 deletions docs/integrations/digitalocean/gslb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ You have two options:
-H "Authorization: Bearer ${NGROK_API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"enabled":true,"outbound":[{"actions":[{"type":"add-headers","config":{"headers": {"is-ngrok": "1","country": "${.ngrok.geo.country_code}"}}}],"name":"Add ngrok headers"}]}'
-d '{"enabled":true,"on_http_response":[{"actions":[{"type":"add-headers","config":{"headers": {"is-ngrok": "1","country": "${.ngrok.geo.country_code}"}}}],"name":"Add ngrok headers"}]}'
```

- In the Traffic Policy module section of your [Edge](https://dashboard.ngrok.com/cloud-edge/edges) in the ngrok dashboard, click the **Edit Traffic Policy** button and then the **YAML** button and add the YAML below.

```yaml
inbound: []
outbound:
on_http_request: []
on_http_response:
- expressions: []
name: Add ngrok headers
actions:
Expand Down
6 changes: 3 additions & 3 deletions docs/integrations/linode/gslb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ You have two options:
-H "Authorization: Bearer ${NGROK_API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"enabled":true,"outbound":[{"actions":[{"type":"add-headers","config":{"headers": {"is-ngrok": "1","country": "${.ngrok.geo.country_code}"}}}],"name":"Add ngrok headers"}]}'
-d '{"enabled":true,"on_http_response":[{"actions":[{"type":"add-headers","config":{"headers": {"is-ngrok": "1","country": "${.ngrok.geo.country_code}"}}}],"name":"Add ngrok headers"}]}'
```

- In the Traffic Policy module section of your [Edge](https://dashboard.ngrok.com/cloud-edge/edges) in the ngrok dashboard, where you can click the **Edit Traffic Policy** button and add the YAML below.

```yaml
inbound: []
outbound:
on_http_request: []
on_http_response:
- expressions: []
name: Add ngrok headers
actions:
Expand Down
10 changes: 5 additions & 5 deletions docs/tcp/traffic-policy/actions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pagination_next: tcp/traffic-policy/actions/deny

Traffic Policy actions enable you to modify the behavior of traffic flowing through your endpoints. The following actions are available for use on your endpoints:

| Type | Description | Supports |
| ---------------------------- | ------------------------------------------- | -------- |
| [deny](deny) | Reject incoming traffic to an endpoint. | Inbound |
| [log](log) | Emit an event with custom defined metadata. | Inbound |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | Inbound |
| Type | Description | Supports |
| ---------------------------- | ------------------------------------------- | -------------- |
| [deny](deny) | Reject incoming traffic to an endpoint. | on_tcp_connect |
| [log](log) | Emit an event with custom defined metadata. | on_tcp_connect |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | on_tcp_connect |
25 changes: 12 additions & 13 deletions docs/tcp/traffic-policy/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import TrafficPolicyWarning from "/shared/warnings/traffic-policy-preview.mdx";
## Overview

This module allows you to assign a policy to your endpoints containing a series
of inbound and outbound rules that can be used to influence and control traffic
to and from your upstream service.
of `on_tcp_connect` rules that can be used to influence and control traffic
to your upstream service.

Policy rules are composed of expressions that filter the traffic on which they are applicable
and actions that should take effect.
Expand Down Expand Up @@ -60,8 +60,8 @@ and actions that should take effect.

## Behavior

Policy rules are evaluated sequentially in the order they are configured with inbound rules taking effect before the
upstream server is reached and outbound rules taking effect after the upstream server responds. Whether or not the configured
Policy rules are evaluated sequentially in the order they are configured with `on_tcp_connect` rules taking effect before the
upstream server is reached. Whether or not the configured
actions are performed is determined at runtime by the expressions.

### Expression Evaluation
Expand All @@ -84,15 +84,14 @@ See [actions](./actions) for all available actions.

### Configuration

| Parameter | Description |
| --------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **inbound** | A list of policy rules that will be applied to inbound traffic in the order specified. |
| **outbound** | A list of policy rules that will be applied to outbound traffic in the order specified. |
| **name** | Policy rules can optionally be given a name for convenience. |
| **expressions** | A list of CEL expressions that filter which traffic a policy rule will apply to. |
| **actions** | A list of actions that will execute sequentially if the associated policy rule's expressions all match on the traffic. |
| **type** | The type of action. |
| **config** | The configuration details of how an action should execute. Each action has its own configuration structure. |
| Parameter | Description |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| **on_tcp_connect** | A list of policy rules that will be applied to inbound traffic in the order specified. |
| **name** | Policy rules can optionally be given a name for convenience. |
| **expressions** | A list of CEL expressions that filter which traffic a policy rule will apply to. |
| **actions** | A list of actions that will execute sequentially if the associated policy rule's expressions all match on the traffic. |
| **type** | The type of action. |
| **config** | The configuration details of how an action should execute. Each action has its own configuration structure. |

## Edges

Expand Down
10 changes: 5 additions & 5 deletions docs/tls/traffic-policy/actions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pagination_next: tls/traffic-policy/actions/deny

Traffic Policy actions enable you to modify the behavior of traffic flowing through your endpoints. The following actions are available for use on your endpoints:

| Type | Description | Supports |
| ---------------------------- | ------------------------------------------- | -------- |
| [deny](deny) | Reject incoming traffic to an endpoint. | Inbound |
| [log](log) | Emit an event with custom defined metadata. | Inbound |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | Inbound |
| Type | Description | Supports |
| ---------------------------- | ------------------------------------------- | -------------- |
| [deny](deny) | Reject incoming traffic to an endpoint. | on_tcp_connect |
| [log](log) | Emit an event with custom defined metadata. | on_tcp_connect |
| [restrict-ips](restrict-ips) | Allow or deny traffic based on source IP. | on_tcp_connect |
2 changes: 1 addition & 1 deletion docs/tls/traffic-policy/expressions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pagination_next: tls/traffic-policy/expressions/writing-guide

# Overview

Traffic Policy module enables you to filter inbound and outbound traffic with [Common Expression Language (CEL)](https://github.com/google/cel-spec) expressions. Each policy rule expression must evaluate to true in order for
Traffic Policy module enables you to filter inbound traffic with [Common Expression Language (CEL)](https://github.com/google/cel-spec) expressions. Each policy rule expression must evaluate to true in order for
the rule's actions to take effect against traffic.

- [Learn how to write CEL expressions](/docs/tls/traffic-policy/expressions/writing-guide).
Expand Down
Loading