HTTP Policy Reuse
Overview
Prior to Avi Vantage release 18.2.3, we did not have the option to use same HTTP policy across multiple virtual services. Starting with Avi Vantage release 18.2.3, HTTP policies created once, can be shared across multiple virtual services. This article will show how to configure the HTTP policy sets and apply it to virtual services.
Creating HTTP Policy Sets and Attaching Policy Sets to Virtual Services
To create HTTP policy sets, follow the steps given below.
- Log in to the Controller and enter the following commands:
admin@abc-controller:~$ shell Login: admin Password:
- Create a standalone
httppolicyset
policy-set-NAME
. Configure the required rules under this and save the policy set.
For example,
+------------------------+----------------------------------------------------+ | 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 | +------------------------+----------------------------------------------------+
- 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
- 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*
- 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 HTTP policy to another virtual service, repeat steps 3 to 4.