Create HTTP policy
The number of HTTP policies in a rule and the number of conditions in an HTTP policy are unlimited.
Control panel
OpenStack CLI
-
In the dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to Balancers → Balancers tab.
-
Open the balancer page.
-
Open the rule card.
-
Click Add New Policy.
-
Select the parameter by which to validate the request:
HOSTNAMEfor the domain name orPATHto validate the path. -
Select the type of match to the reference value:
EQUAL TO- match;STARTS WITH.- begins with;ENDS WITH.- ends with;CONTAINS- Contains;REGEX- regular expression.
-
Enter a control value to check. If you selected the
REGEXcondition in step 7, enter a regular expression. -
Optional: To add another condition to the policy, click New Condition and customize it. If there are multiple conditions in the policy, the request must match each of them to fall under the policy.
-
Specify where to redirect the matching request:
- Direct to a target group - select a target group or create a new one with the HTTP protocol;
- URL redirect - enter a target URL that will completely replace the request URL, including protocol, domain name, path, and request parameters;
- Redirect to URL prefix - enter the part of the URL to replace the protocol and domain name in the URL requests. For example, if you enter
https://example.com/new, then the request tohttps://example.com/apiwill be forwarded tohttps://example.com/new/api
To not accept requests that match the policy, select Deny Traffic.
-
Enter a policy name or leave the default one generated.
-
Click Add.