# Multiple ASM policy applied on Virtual Server

**URL:** <https://community.f5.com/t/multiple-asm-policy-applied-on-virtual-server/55246>\
**Category:** Technical Forums\
**Tags:** asm-advanced-waf, security, ltm\
**Created:** [January 17, 2022, 9:33am UTC](https://community.f5.com/t/multiple-asm-policy-applied-on-virtual-server/55246 "2022-01-17T09:33:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preet\_pk](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@Preet\_pk](https://community.f5.com/u/Preet_pk)\
**Post date:** [January 17, 2022, 9:33am UTC](https://community.f5.com/t/multiple-asm-policy-applied-on-virtual-server/55246/1 "2022-01-17T09:33:54Z")

</div>

Hi,

We have a F5 design were single Virtual Server (VIP) is pointing to multiple application on back-end via iRule & iRule load balancing is based on HTTP::host (Layer 7)

for eg:

when HTTP\_REQUEST {

switch [string tolower [HTTP::host]] {

a.test.ae {

pool a\_test\_Pool1}

b.test.ae {

pool b\_test\_Pool1 }

}

}

We have a requirement to apply ASM policy on specific application (for eg: application “a”) - while enforcing ASM policy specific to application “a” & applied on Virtual Server, will application “b” break? if so, please let me know what will be the best approach in this scenario.

---

<div class="post-metadata">

**Author:** ![Jim\_Schwartzme1](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@Jim\_Schwartzme1](https://community.f5.com/u/Jim_Schwartzme1)\
**Post date:** [January 19, 2022, 8:30pm UTC](https://community.f5.com/t/multiple-asm-policy-applied-on-virtual-server/55246/2 "2022-01-19T20:30:38Z")

</div>

You can apply the ASM policy in your irule when you select the pool. You’ll want to enable the policy for the pools that need it and disable it on the pools that dont.

[https://devcentral.f5.com/s/question/0D51T00006i7jvy/apply-asm-policy-through-irule](https://devcentral.f5.com/s/question/0D51T00006i7jvy/apply-asm-policy-through-irule)

Your code should look something like this:

when HTTP\_REQUEST {

switch [string tolower [HTTP::host]] {

[a.test.ae](http://a.test.ae/)&nbsp;{

pool a\_test\_Pool1

ASM::enable “/Common/\<asm Policy name\>”}

[b.test.ae](http://b.test.ae/)&nbsp;{

pool b\_test\_Pool1

ASM::disable}

}

}

---

<div class="post-metadata">

**Author:** ![Sebastiansierra](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/sebastiansierra/32/3473_2.png) [@Sebastiansierra](https://community.f5.com/u/Sebastiansierra)\
**Post date:** [February 18, 2022, 10:18am UTC](https://community.f5.com/t/multiple-asm-policy-applied-on-virtual-server/55246/3 "2022-02-18T10:18:01Z")

</div>

Hi,

The best solution that you can apply to avoid future errors with the irule is using LTM Policy, You can execute multiple actions as:

\* Read the host and send to a specific pool

\*Apply an ASM polity to that pool

\*Many more.

Follow this article to configure Ltm Policy:

> **[Configuring ASM with Local Traffic Policies | BIG-IP Documentation](https://techdocs.f5.com/en-us/bigip-14-1-0/big-ip-asm-implementations-14-1-0/configuring-asm-with-local-traffic-policies.html)**
>
> Usage information and technical documentation for BIG-IP and other related F5 products
