Path Route Sets
You can apply a set of path routes to a LBaaS resource. A path route is a string that
the load balancer matches against an incoming URI to determine the appropriate destination
backend set. Some applications have multiple endpoints or content types, each distinguished by
a unique URI path. For example, /admin/
, /data/
,
/video/
, or /cgi/
.
The idea behind path route sets is to conserve resources. With path route sets, you can use the path route rules to route traffic to the correct backend set without using multiple listeners or load balancers.
Path route rules apply only to HTTP and HTTPS requests and have no effect on TCP requests.
A path route set includes all path route rules that define the data routing for a particular listener.
Note:
Path route sets have several restrictions:- You can't use asterisks in path route strings.
- You can't use regular expressions.
- Path route string matching is case-insensitive (that is, "data" or "DATA" is a match).
- You can specify up to 20 path route rules for each path route set.
- You can have one path route set for each listener. The maximum number of listeners limits the number of path route sets you can specify for a load balancer.
- Browsers often add an ending slash to the path in a request. If you specify a path such
as
/admin
, you might want to configure the path both with and without the trailing slash. For example,/admin
and/admin/
.
/video/
, or
/cgi/
. The pattern match can be:
- EXACT_MATCH: The path string must match the incoming URI path exactly.
-
FORCE_LONGEST_PREFIX_MATCH: The path string must match longest ("best") match of the beginning portion of the incoming URI path.
-
PREFIX_MATCH: The path string must match the beginning portion of the incoming URI path.
- SUFFIX_MATCH: The path string must match the ending portion of the incoming URI path.
This section creates path route sets using the Compute Web UI and OCI CLI.
Creating a Path Route Set
You can create a path route set for a LBaaS resource to distinguish by unique URL paths such
as /admin/
, /data/
, /video/
, or
/cgi/
.
Path route rules apply only to HTTP and HTTPS requests and have no effect on TCP requests.
Using the Compute Web UI
-
Open the Navigation Menu. Under Networking, click Load Balancers.
- Select the name of load balancer for which to create the path route set.
- Click Path Route Sets under the Resources for the load balancer.
-
Click the Create Path Route Set button to open the Create Path Route Set dialog.
-
Enter the following information:
-
Name: Enter a descriptive name for the Path Route Set.
-
Path Route Rules: Enter the following required information for Path Route Rule 1.
- Match Style: Select Exact Match, Force Longest Prefix Match, Prefix Match, or Suffix Match.
- URL String: Enter the pattern that the style seeks to match.
- Backend Set: Select the name of the backend set from the drop-down list. If you haven't yet created a backend set, you can't create a path route set.
-
+New Rule: Select this option if you want to create more than one rule for the path route set.
-
-
Click the Create Path Route Set button in the dialog.
Using the OCI CLI
-
Gather the information that you need to run the command:
-
Load balancer OCID (
oci lb load-balancer list --compartment-id compartment_OCID
)
-
-
Enter the
lb path-route-set create
command using minimal private LB options. To list all details of the LB, use thelb load-balancer get
command.Note:
For information about optional parameters, run the command with the
--help
option.Syntax (entered on a single line):
oci lb path-route-set create --name name-of-path-route-set \ --path-routes [COMPLEX-TYPE] --load-balancer-id load-balancer_OCID
Example:
$ oci lb path-route-set create --name example-path-route-set --path-routes "[{"path": "/new/","pathMatchType": {"matchType": "EXACT_MATCH"}, "backendSetName":"example_backend_set"}] --load-balancer-id "ocid1.load-balancer...unique_ID" { "opc-work-request-id": "ocid1.workrequest.1X49XC30ZP...unique_ID" }
Note:
The create command returns a work request ID. To see the path route set results, use the path route set get command.$ oci lb path-route-set get --name example-path-route-set --load-balancer-id "ocid1.load-balancer...unique_ID" "data": { "name": "example-path-route-set", "pathRoutes": [ { "path": "/new/", "pathMatchType": { "matchType": "EXACT_MATCH" }, "backendSetName": "example_backend_set" } ] }
Viewing a Path Route Set Details
You can view path route set details for a LBaaS resource.
Using the Compute Web UI
-
Open the Navigation Menu. Under Networking, click Load Balancers.
- Select the name of load balancer for which to view path route set details.
- Click Path Route Sets under the Resources for the load balancer.
-
Click View Details under the Actions icon (three dots) for the Path Route Set to display the details.
Using the OCI CLI
-
Gather the information that you need to run the command:
-
Load balancer OCID (
oci lb load-balancer list --compartment-id compartment_OCID
)
-
-
Enter the
lb path-route-set get
command using the load balancer OCID.Note:
For information about optional parameters, run the command with the
--help
option.Syntax (entered on a single line):
oci lb path-route-set get --load-balancer-id load-balancer_OCID --path-route-set-name name-of-path-route-set
Example:
$ oci lb path-route-set get --load-balancer-id "ocid1.load-balancer.unique_ID" \ --path-route-set-name example-path-route-set "data": { "name": "example_path_route_set", "pathRoutes": [ { "path": "/example/video/123", "pathMatchType": { "matchType": "EXACT_MATCH" }, "backendSetName": "example_backend_set" } ] }
Editing a Path Route Set
You can edit a path route set to update the details.
Using the Compute Web UI
-
Open the Navigation Menu. Under Networking, click Load Balancers.
- Select the name of load balancer for which to update the path route set details.
- Click Path Route Sets under the Resources for the load balancer.
-
Click Edit under the Actions icon (three dots) for the Path Route Set to edit the details.
- Click Save Changes to update the Path Route Set.
Using the OCI CLI
-
Gather the information that you need to run the command:
-
Load balancer OCID (
oci lb load-balancer list --compartment-id compartment_OCID
)
-
-
Enter the
lb path-route-set update
command using the load balancer OCID.Note:
For information about optional parameters, run the command with the
--help
option.Syntax (entered on a single line):
oci lb path-route-set update --load-balancer-id load-balancer_OCID --path-route-set-name name-of-path-route-set
Example:
$ oci lb path-route-set update --load-balancer-id "ocid1.load-balancer.unique_ID" \ --path-route-set-name example-path-route-set \ --path-routes "[{"path": "/new/","pathMatchType": {"matchType": "PREFIX_MATCH"}, \ "backendSetName":"example_backend_set"}] WARNING: Updates to path-routes will replace any existing values. Are you sure you want to continue? [y/N]: y { "opc-work-request-id": "ocid1.workrequest.1749XC302P...unique_ID" }
Note:
The update command returns a work request ID. To see the path route set results, use the path route set get command.$ oci lb path-route-set get --name example-path-route-set --load-balancer-id "ocid1.load-balancer...unique_ID" "data": { "name": "example-path-route-set", "pathRoutes": [ { "path": "/new/", "pathMatchType": { "matchType": "PREFIX_MATCH" }, "backendSetName": "example_backend_set" } ] }
Deleting a Path Route Set
You can delete a path route set for a LBaaS resource.
Using the Compute Web UI
-
Open the Navigation Menu. Under Networking, click Load Balancers.
- Select the name of load balancer for which to delete the path route set.
- Click Path Route Sets under the Resources for the load balancer.
-
Click Delete under the Actions icon (three dots) for the Path Route Set.
- Click Confirm to delete the Path Route Set.
Using the OCI CLI
-
Gather the information that you need to run the command:
-
Load balancer OCID (
oci lb load-balancer list --compartment-id compartment_OCID
)
-
-
Enter the
lb path-route-set delete
command using the load balancer OCID.Note:
For information about optional parameters, run the command with the
--help
option.Syntax (entered on a single line):
oci lb path-route-set delete --load-balancer-id load-balancer_OCID --path-route-set-name name-of-path-route-set
Example:
$ oci lb path-route-set delete --load-balancer-id "ocid1.load-balancer.unique_ID" \ --path-route-set-name example-path-route-set Are you sure you want to delete this resource? [y/N]: y
Note:
To delete the LB backend set without verification, run the command with the
--force
option.