Forum Discussion
Parveez_70209
Nov 06, 2013Nimbostratus
Irules Data-Group
Hi,
Need your assistance into this topic related to Irule Based on Data-Groups:
Currently we have total 120 Virtual-Servers( 60 HTTP profiles + 60 HTTPS Profiles) created into the Load-Balancer ...
IheartF5_45022
Dec 11, 2013Nacreous
Here;-
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
log local0. "Default pool [LB::server pool] set "
log local0. "Client IP is [IP::remote_addr]"
}
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/" {
log local0. "redirecting from /"
if { [class match [LB::server pool] equals Parveez_pools] } {
HTTP::respond 301 Location "[class match -value [LB::server pool] equals Parveez_pools]" Cache-Control "no-cache"
} else {
log local0. "Static pool entry for [LB::server pool] not created yet"
reject
}
return
}
"/iss_static*" {
if { [class match [virtual] equals Parveez_Static104] } {
pool [lindex [split [class match -value [virtual] equals Parveez_Static104] ","] 1]
} else {
log local0. "Static pool entry for [virtual] not created yet"
reject
}
return
}
default {
if { [class match [virtual] equals Parveez_Dynamic104] } {
pool [lindex [split [class match -value [virtual] equals Parveez_Dynamic104] ","] 0]
} else {
log local0. "Dynamic pool entry for [virtual] not created yet"
reject
}
return
}
}
}
You may wonder why I add Cache-Control "no-cache" to the 302 redirect - gotta be careful of 301 redirect - if you accidentally return an invalid Location header to a browser, some of them will refuse to obey it, but cache it anyway, and you cannot get rid of cached 301s easily. Also if you just want to change it later you cannot, adding no-cache means that you get all the SEO benefits of a 301 without the headache.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects