Skip to main content

Create an HTTP policy

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, in 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 by which the request will be checked: HOSTNAME for a domain name or PATH to check the path.

  7. Select the match type for the control value:

    • EQUAL TO — matches;
    • STARTS WITH — starts with;
    • ENDS WITH — ends with;
    • CONTAINS — contains;
    • REGEX — regular expression.
  8. Enter the check value. 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 there are multiple conditions in a policy, a request must match each of them to fall under the policy.

  10. Specify where to redirect a matching request:

    • Forward 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 query parameters;
    • Redirect to URL prefix — enter the part of the URL to replace the protocol and domain name in request URLs with. 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 reject requests matching the policy, select Reject traffic.

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

  12. Click Add.