Forum Discussion
Tom_185829
Nimbostratus
Dec 09, 2015LTM iRule recursive redirect
Hi
I have virtual server configuration with :
irule
policy
Policy create select pool when you give a name for example:
virtual server IP: 10.10.10.1
CNAME: app1.example.com to 10.10.10.1
For cont...
Stanislas_Piro2
Cumulonimbus
Dec 09, 2015Hi,
the irule provided by Kai is right except the order of conditions:
if uri equals /, it never executed the
elseif { ${uri} eq "/" } because it entered in the first condition
when HTTP_REQUEST {
set HostName [getfield [HTTP::host] "." 1 ]
if { [HTTP::uri] equals "/" } {
set uri [class lookup ${HostName} REDIRECTS]
if { ${uri} eq "/" } {
allow request to root app if selected by class lookup
return
} elseif { ${uri} ne "" } {
HTTP::respond 301 noserver Location "${uri}" Connection Close
return
} else {
HTTP::respond 301 noserver Location "https://${HostName}[HTTP::uri]" Conection Close
return
}
event disable all
TCP::close
return
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
