# if HTTPS route to specified pool

**URL:** <https://community.f5.com/t/if-https-route-to-specified-pool/1546>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [September 29, 2005, 6:51pm UTC](https://community.f5.com/t/if-https-route-to-specified-pool/1546 "2005-09-29T18:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobbie\_Hermanso](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Bobbie\_Hermanso](https://community.f5.com/u/Bobbie_Hermanso)\
**Post date:** [September 29, 2005, 6:51pm UTC](https://community.f5.com/t/if-https-route-to-specified-pool/1546/1 "2005-09-29T18:51:56Z")

</div>

I am trying to use a nested If statement to route to specific pools. In one situation, if the url is https:xxx then I want to route to different pool. Can this be done?

Here is an example of what I am trying to do:

when HTTP\_REQUEST {

if { [HTTP::host] eq “[vs1.domain.com](http://vs1.domain.com)”} {

pool pool1

} elseif { [HTTP::host] eq “[vs2.domain.com](http://vs2.domain.com)”} {

pool pool2

} elseif { [HTTP::host] eq “[vs3.domain.com](http://vs3.domain.com)”} {

pool pool3

} elseif { [HTTPS::host] eq “[vs.domain.com](http://vs.domain.com)”} {

pool pool3ssl

} else {

pool defaultpool

}

}

Thanks in advance for any advice.

---

<div class="post-metadata">

**Author:** ![Joe\_Pruitt](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joe_pruitt/32/8438_2.png) [@Joe\_Pruitt](https://community.f5.com/u/Joe_Pruitt)\
**Post date:** [September 29, 2005, 10:12pm UTC](https://community.f5.com/t/if-https-route-to-specified-pool/1546/2 "2005-09-29T22:12:15Z")

</div>

The one issue I see with your rule is that there is no “HTTPS::host” variable. You’ll have to check the “TCP::local\_port” value to check whether this is on port 443 (https) or not.

ie.

```tcl
when HTTP_REQUEST {
  if { [HTTP::host] eq "vs1.domain.com"} {
    pool pool1
  } elseif { [HTTP::host] eq "vs2.domain.com"} {
    pool pool2
  } elseif { [HTTP::host] eq "vs3.domain.com"} {
    pool pool3
  } elseif { ([TCP::local_port] == 443) and ([HTTP::host] eq "vs.domain.com") } {
    pool pool3ssl
  } else {
    pool defaultpool
  }
}

```

-Joe
