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, 2015To limit loop, you can apply the following irule to both http and https VS:
when HTTP_REQUEST {
set redirect 0
set host [HTTP::host]
set uri [HTTP::uri]
set domain "company.com"
if { !($host contains ".")} {
If domain is not set, append domain to host variable and force redirect
set HostName $host
set host "$host.$domain"
set redirect 1
} else {
set HostName [getfield $host "." 1 ]
}
if { $uri equals "/" } {
set newuri [class lookup ${HostName} REDIRECTS]
if { !(${newuri} eq "/") && (${newuri} ne "") } {
set redirect 1
set uri $newuri
unset newuri
}
}
if {$redirect} {
HTTP::respond 301 noserver Location "https://$host${uri}" Connection Close
}
}
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
