# Using wildcard for multiple URI

**URL:** <https://community.f5.com/t/using-wildcard-for-multiple-uri/58442>\
**Category:** Technical Forums\
**Tags:** big-ip, irules, application-delivery\
**Created:** [January 26, 2018, 3:36am UTC](https://community.f5.com/t/using-wildcard-for-multiple-uri/58442 "2018-01-26T03:36:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wkirk](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wkirk](https://community.f5.com/u/wkirk)\
**Post date:** [January 26, 2018, 3:36am UTC](https://community.f5.com/t/using-wildcard-for-multiple-uri/58442/1 "2018-01-26T03:36:28Z")

</div>

We have an existing iRule and datagroup,

```tcl
when HTTP_REQUEST {
set uri [HTTP::uri]
if {[class match $uri starts_with DG1]} {
    pool POOL_SSL
    }
if {[class match $uri eq DG_EXACT] or $uri eq "/" } {
    pool POOL_SSL
    }
}

```

Is it possible to use a wildcard like “/\*” in the datagroup such that we no longer need to add thousands of URI in the future?

---

<div class="post-metadata">

**Author:** ![jaikumar\_f5](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@jaikumar\_f5](https://community.f5.com/u/jaikumar_f5)\
**Post date:** [January 26, 2018, 5:21am UTC](https://community.f5.com/t/using-wildcard-for-multiple-uri/58442/2 "2018-01-26T05:21:31Z")

</div>

If your intention is to allow every URI of a particular domain, why do you put wildcard of /\* rather than just whitelisting the particular domain itself.

So you need not worry of adding thousands of URI, but just allow that particular host.

```tcl
when HTTP_REQUEST {
if { [HTTP::host] contains "domain.com" }
{ pool POOL_SSL }
else 
{ drop }
}

```

---

<div class="post-metadata">

**Author:** ![stan\_piron](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@stan\_piron](https://community.f5.com/u/stan_piron)\
**Post date:** [January 26, 2018, 7:31am UTC](https://community.f5.com/t/using-wildcard-for-multiple-uri/58442/3 "2018-01-26T07:31:45Z")

</div>

Is it possible to use a wildcard like “/\*” in the datagroup such that we no longer need to add thousands of URI in the future?

When reading your code, you can see there are 2 Datagroups

- DG1 with command starts\_with which does the same as you expect
- DG\_EXACT with command equals

So the code seems good!

---

<div class="post-metadata">

**Author:** ![stan\_piron](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@stan\_piron](https://community.f5.com/u/stan_piron)\
**Post date:** [January 26, 2018, 1:24pm UTC](https://community.f5.com/t/using-wildcard-for-multiple-uri/58442/4 "2018-01-26T13:24:57Z")

</div>

This code may replace all irules!

```tcl
when HTTP_REQUEST {
    set uri [HTTP::uri]
    set target [getfield [HTTP::uri] "/" 2]
    if {[class match $uri starts_with DG2]} {
        pool POOL_OTHER1
    } else {
        switch -glob -- [HTTP::uri] {
            "*/other2*" -
            "/other2_1*" -
            "/other2_1*" {
                pool POOL_OTHER2
            }
            "/other3*" -
            "/other3_1*" -
            "/other3_2*" -
            "/" {
                pool POOL_OTHER3
            }
            "/other3_3*" {
                pool POOL_OTHER3_3
            }
            "/3_4*"{
                pool POOL_OTHER3_4
            }
            "/3_5/" {
                pool POOL_OTHER3_5
            }
            "/3_6/" {
                pool POOL_OTHER3_6
            }
            default {
                pool POOL_SSL
            }
        }
    }
}

when SERVER_CONNECTED {
  if { [LB::server pool] eq "POOL_OTHER2" } {
    SSL::disable serverside
  }
}

```
