diff --git a/images/targets_config.png b/images/targets_config.png new file mode 100644 index 0000000..3763b97 Binary files /dev/null and b/images/targets_config.png differ diff --git a/manage/blueprints.mdx b/manage/blueprints.mdx index 3f7fa17..5d01891 100644 --- a/manage/blueprints.mdx +++ b/manage/blueprints.mdx @@ -13,6 +13,18 @@ Pangolin supports two blueprint formats: ## YAML Configuration Format +YAML config can be applied using the API or from a Newt site. _Application through a CLI tool is planned._ + + + + Newt automatically discovers and applies blueprints defined in YAML format when passing the `--blueprint-file` argument. For example + + ```bash + newt --blueprint-file /path/to/blueprint.yaml + ``` + + + ### Proxy Resources Proxy resources are used to expose HTTP, TCP, or UDP services through Pangolin. Below is an example configuration for proxy resources: @@ -110,7 +122,7 @@ When using targets-only resources, the `name` and `protocol` fields are not requ ### Client Resources -Client resources are only accessible when connected via an Olm client: +Client resources define proxied resources accessible when connected via an Olm client: ```yaml client-resources: diff --git a/manage/resources/targets.mdx b/manage/resources/targets.mdx index beac73a..5041a1d 100644 --- a/manage/resources/targets.mdx +++ b/manage/resources/targets.mdx @@ -54,29 +54,54 @@ newt --prefer-endpoint Pangolin currently does not load balance between nodes, only between targets on the same node. -## Configuring Targets +## Path-Based Routing - - - In the Pangolin dashboard, go to the **Resources** section. - +Path-based routing allows you to direct traffic to different targets based on the request path. This enables sophisticated routing scenarios where different services can handle different parts of your application. - - Either create a new resource or select an existing resource to edit. - +### How Path-Based Routing Works - - Click **Add Target** to configure a new destination. - +Each target can be configured with optional path routing parameters: - - Specify the target configuration: - - **Address**: IP address or hostname of the target service - - **Port**: Port number where the service is listening - - **Site**: Select the site where this target is located - - +- **Path**: The path pattern to match against incoming requests +- **Match**: The matching strategy to use when comparing the request path - -Pangolin uses round-robin load balancing by default, distributing traffic evenly across all targets. - \ No newline at end of file +When a request comes in, Pangolin evaluates the path against all targets and routes traffic to the target with the matching path configuration. + +### Match Types + +Pangolin supports three different matching strategies: + + + **exact**: The request path must match the configured path exactly. + + Example: Path `/api/users` with exact match only matches `/api/users` + + + + **prefix**: The request path must start with the configured path. + + Example: Path `/api` with prefix match matches `/api/users`, `/api/orders`, `/api/users/123`, etc. + + + + **regex**: The request path is matched against a regular expression pattern. + + Example: Path `^/api/users/[0-9]+$` with regex match matches `/api/users/123` but not `/api/users/abc` + + + + Targets example + + +### Load Balancing with Path-Based Routing + +When multiple targets have the same path and match configuration, Pangolin will load balance between them using round-robin distribution. + +**Example Scenario:** +- Target 1: Path `/api`, Match `prefix`, Address `10.0.1.10:8080` +- Target 2: Path `/api`, Match `prefix`, Address `10.0.1.11:8080` +- Target 3: Path `/web`, Match `prefix`, Address `10.0.1.12:80` + +In this configuration: +- Requests to `/api/users` will be load balanced between Target 1 and Target 2 +- Requests to `/web/dashboard` will only go to Target 3 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..15b832f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "docs-v2", + "lockfileVersion": 3, + "requires": true, + "packages": {} +}