You can use request policies to modify HTTP requests before they are forwarded to the application.

Procedure

  1. In the top navigation bar, click Networking and click the Edge Gateways tab.
  2. Click the NSX edge gateway, and under Load Balancer, click Virtual Services.
  3. Click the vertical ellipsis () on the left of the virtual service name and select Configure Policies.
  4. Click HTTP Request, and click New.
  5. Enter a name for the rule.
  6. To activate the rule upon creation, toggle on the State option.
  7. Under Match Criteria, click New.
  8. Select one or more match criteria and enter the necessary input.
    Option Description
    Client IP Address
    1. Select whether to perform an action if the client IP matches or doesn't match the value that you enter.
    2. Enter an IPv4 address, or an IPv6 address, or a range, or a CIDR notation.
    3. (Optional) To add more IP addresses, click Add IP.
    Service Port
    1. Select whether to perform an action if the virtual service port matches or doesn't match the value that you enter.
    2. Enter a port or a list of ports in a comma-separated list.
    Protocol Type Select a type of protocol.
    HTTP Method
    1. Select whether to perform an action if the HTTP method matches or doesn't match the value that you enter.
    2. Select one or more HTTP methods used by the client request.
    Path
    1. Select a criteria for the path.
    2. Enter a path string.
      Note: The path doesn't need to begin with a forward slash (/).
    3. (Optional) To add more paths, click Add Path.
    Query
    1. Enter text that is part of a query string.
    2. (Optional) To enter more queries, click Add Query.
    Request Headers
    1. Select a criteria for the request header.
    2. Enter a name for the header.
    3. Enter one or more values for the header.
    4. To add more headers, click Add Header.
    Cookie
    1. Select a criteria for the cookie.
    2. Enter a name for the cookie.
    3. Enter a value.
  9. Select an action to perform upon a match.
    Option Description
    Redirect To redirect the request, enter the necessary information.
    1. Select a redirect protocol.
    2. Enter a port.
    3. Select a status code.
    4. Enter a custom host name.
    5. Enter a path.
    6. To keep the original query parameters in the modified request, select the Keep Query check box.
    Modify Header To modify the request header, follow the steps.
    1. Select whether to remove, add, or replace the HTTP header.
    2. Enter the custom header value.
    3. To configure additional header modification actions, click Add Action and repeat substeps a. and b..
    Rewrite URL
    1. Enter a custom host header.
    2. Enter an existing custom path.
    3. To keep the original query parameters in the modified request, select the Keep Query check box.
    4. (Optional) If you selected Keep Query, add more query parameters.
  10. Click Add.
  11. To add another rule, repeat steps 6 through 12.
  12. To move a rule up or down the list, click the vertical ellipsis () on the left of the rule name and select the desired action.
  13. To save your changes, click Save.