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

Add more internal endpoint docs #943

Open
wants to merge 2 commits into
base: euan/internal-endpoints
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
1 change: 1 addition & 0 deletions docs/http/traffic-policy/actions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Traffic Policy actions enable you to modify the behavior of traffic flowing thro
| [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 |
| [forward-internal](forward-internal) | Forward the request to a internal endpoint on your account. | Inbound |
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ const sidebars = {
items: [
"network-edge/index",
"network-edge/domains-and-tcp-addresses",
"network-edge/internal-endpoints",
"network-edge/edges",
"network-edge/gslb",
"network-edge/tls-certificates",
Expand Down
12 changes: 11 additions & 1 deletion traffic-policy/actions/forward-internal/behavior.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Behavior

When the Forward Internal action executes, it will look up the specified endpoint and relay any incoming traffic. The endpoint being forwarded to will behave as if the traffic was sent directly to it and execute all of the actions in its associated Traffic Policy. The endpoint being forwarded to must exist in the same ngrok account and be the same protocol as the forwarding endpoint (e.g. an HTTP public endpoint can only forward to an HTTP internal endpoint). You also may not forward traffic to a second internal endpoint or back to the original endpoint in a loop.
This action forwards a request to an internal endpoint.

Any traffic policy associated with the internal endpoint will also be applied to the request when it's forwarded.

If the forwarding is successful, the response from the upstream for the internal endpoint will be sent back to the client making the original request. No further actions in the `inbound` phase will be executed and no traffic will be sent to the upstream for the public endpoint.

Expand All @@ -21,3 +23,11 @@ The action will also set the `X-Forwarded-For`, `X-Forwarded-Host`, and `X-Forwa
If `on_error` is set to `halt` (default) and the action encounters an error when forwarding traffic, the Traffic Policy chain will halt and no further actions will be executed. For example, if you have a `log` action after the `forward-internal` action and the `url` specified isn't an online endpoint, the `log` action will not be run and the error will be returned.

However, if `on_error` is set to `continue`, actions that appear after the `forward-internal` action will still be executed even if the `forward-internal` action encounters an error. This can be used as a fallback to forward traffic to one of many endpoints depending which are online.

### Valid forward targets

A request may only be forwarded to a internal endpoint on the same account as this endpoint.

The target must be of the same protocol (i.e. an HTTP Endpoint may only forward to an HTTP Internal Endpoint).

In addition, the target's traffic policy may only specify policy for the current protocol, for example if `forward-internal` is used in the `on_http_request` phase, the internal endpoint may only have `on_http_request` and `on_http_response` sections.
14 changes: 7 additions & 7 deletions traffic-policy/actions/forward-internal/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ reference for this action.

### Configuration Fields

| Parameter | Type | Description |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `url` | `string` | **Required.** URL of the Endpoint to forward traffic to. |
| `binding` | `string` | Binding of the Endpoint (only `internal` is currently supported). |
| `on_error` | `string` | Whether or not further actions in the Traffic Policy should run if there is an error. Must be either `halt` (default) or `continue`. |
| Parameter | Type | Description |
| ---------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `binding` | `string` | Binding of the Endpoint (only `internal` is currently supported). |
| `url` | `string` | **Required.** The endpoint to forward to, such as `http://my-internal-endpoint.internal:1234` |
| `on_error` | 'halt' \| 'continue' | Whether or not further actions in the Traffic Policy should run if there is an error. Must be either `halt` (default) or `continue`. |

### Supported Directions

- `inbound`

### Supported Schemes

- `https`
- `http`
- `tls`
- `https`
- `tcp`
- `tls`
2 changes: 1 addition & 1 deletion traffic-policy/actions/forward-internal/examples/index.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BasicExample from "./basic-example.mdx";
import BasicExample from "./1-basic-example.mdx";

## Examples

Expand Down
Loading