# iRule Required.

**URL:** <https://community.f5.com/t/irule-required/20179>\
**Category:** Technical Forums\
**Tags:** irules, security, ltm\
**Created:** [April 3, 2018, 2:52pm UTC](https://community.f5.com/t/irule-required/20179 "2018-04-03T14:52:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sachin\_M\_258695](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Sachin\_M\_258695](https://community.f5.com/u/Sachin_M_258695)\
**Post date:** [April 3, 2018, 2:52pm UTC](https://community.f5.com/t/irule-required/20179/1 "2018-04-03T14:52:04Z")

</div>

We have requirement where i have to match both IP(Data group created already) and “User Agents” To allow a traffic to VIP.

Kindly help me to build iRule.

Thanks Sachin M

---

<div class="post-metadata">

**Author:** ![youssef1](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@youssef1](https://community.f5.com/u/youssef1)\
**Post date:** [April 3, 2018, 3:00pm UTC](https://community.f5.com/t/irule-required/20179/2 "2018-04-03T15:00:47Z")

</div>

Hello,

```tcl
when HTTP_REQUEST {

if { [class match [IP::client_addr] equals my_ip_dg] && [class [string tolower [HTTP::header "User-Agent"]] contains allow_user_agent ] } {
     Do what's you want
}

}

```

I let you optimise Irule according to your needs…

Regards

---

<div class="post-metadata">

**Author:** ![RubenM](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@RubenM](https://community.f5.com/u/RubenM)\
**Post date:** [April 3, 2018, 3:02pm UTC](https://community.f5.com/t/irule-required/20179/3 "2018-04-03T15:02:27Z")

</div>

Try with [[HTTP::header User-Agent]](https://devcentral.f5.com/questions/httpheader-user-agent)

Here you have some similar example [https://devcentral.f5.com/questions/block-a-user-agent-with-an-irule](https://devcentral.f5.com/questions/block-a-user-agent-with-an-irule)

---

<div class="post-metadata">

**Author:** ![Sachin\_M\_258695](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Sachin\_M\_258695](https://community.f5.com/u/Sachin_M_258695)\
**Post date:** [April 4, 2018, 12:49pm UTC](https://community.f5.com/t/irule-required/20179/4 "2018-04-04T12:49:39Z")

</div>

Thanks for the response and Time. I go through the link.
