Skip to main content

Create an HTTP policy

Last update:

There is no limit to the number of HTTP policies in a rule or the number of conditions in an HTTP policy.

  1. In the Control panel, on the top menu, click Products and select Cloud Servers.

  2. Go to the Load Balancers section → Load Balancers **** tab.

  3. Open the load balancer page.

  4. Open the rule card.

  5. Click Add New Policy.

  6. Select the parameter to check the request against: HOSTNAME for a domain name or PATH to check the path.

  7. Select the match type for the control value:

    • EQUAL TO — equals;
    • STARTS WITH — starts with;
    • ENDS WITH — ends with;
    • CONTAINS — contains;
    • REGEX — regular expression.
  8. Enter the control value for verification. If you selected the REGEX condition in step 7, enter a regular expression.

  9. Optional: to add another condition to the policy, click New Condition and configure it. If a policy has multiple conditions, the request must match all of them for the policy to apply.

  10. Specify where to redirect a matching request:

    • Redirect to target group — select a target group or create a new one with the HTTP protocol;
    • Redirect to URL — enter the target URL that will completely replace the request URL, including the protocol, domain name, path, and request parameters;
    • Redirect to URL prefix — enter the part of the URL that should replace the protocol and domain name in the request URL. For example, if you enter https://example.com/new, a request to https://example.com/api will be redirected to https://example.com/new/api

    To not accept requests that match the policy, select Reject traffic.

  11. Enter a name for the policy or leave the default one.

  12. Click Add.