HTTP policies created once can be shared across multiple virtual services. This section details the steps to configure the HTTP policy sets and apply them to virtual services.

Creating HTTP Policy Sets and Attaching them to Virtual Services

To create HTTP policy sets, follow the steps below.

1. Log in to the Controller and enter the following commands.

     admin@abc-controller:~$ shell
     Login: admin
     Password:

2. Create a standalone http policy set named httppolicyset_demo. Configure the required rules under the policy set and save it. See the following output for more details on the configuration.

      +------------------------+----------------------------------------------------+
      | Field                  | Value                                              |
      +------------------------+----------------------------------------------------+
      | uuid                   | httppolicyset-dd4e996a-15cc-456c-ad56-086bf21b6e75 |
      | name                   | httppolicyset_demo                                 |
      | http_request_policy    |                                                    |
      |   rules[1]             |                                                    |
      |     name               | Demo_Rule1                                         |
      |     index              | 1                                                  |
      |     enable             | True                                               |
      |     match              |                                                    |
      |     path               |                                                    |
      |     match_criteria     | CONTAINS                                           |
      |     match_case         | INSENSITIVE                                        |
      |     match_str[1]       | index.html                                         |
      |     switching_action   |                                                    |
      |     action             | HTTP_SWITCHING_SELECT_LOCAL                        |
      |      status_code       | HTTP_LOCAL_RESPONSE_STATUS_CODE_429                |
      |     log                | True                                               |
      | is_internal_policy     | False                                              |
      | tenant_ref             | admin                                              |
      +------------------------+----------------------------------------------------+

3. Attach the httppolicyset_demo to the virtual service required.

 [admin:abc-controller]: configure virtualservice *VS1*
 [admin:abc-controller]: virtualservice> http_policies
 [admin:abc-controller]: virtualservice> http_policies http_policy_set_ref

4. Press the Tab key to display the list of the httppolicyset objects.

  VS1-Default-Cloud-HTTP-Policy-Set-0  VS2-Default-Cloud-HTTP-Policy-Set-0.  
     *httppolicyset_demo*

5. Attach the policy set and save.

     [admin:abc-controller]: virtualservice> http_policies http_policy_set_ref *httppolicyset_demo*
     New object being created
     [admin:abc-controller]: virtualservice:http_policies>save

To reattach the HTTP policy to other virtual services, repeat the previous two steps for each virtual service.