Forum Discussion
Thiyagu_343098
Nimbostratus
Jul 04, 2018irule help to fix the error
Hello all,
I'm getting below error while executing this script.
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] contains "test1.com"}{
set newurl [string map -nocase {"test1.co...
Stanislas_Piro2
Cumulonimbus
Jul 05, 2018This code will redirect :
- to
- net.staging.test1.com to net.staging.test2.com
when CLIENT_ACCEPTED {
set redirect_list [list ".test1.com" ".test2.com"]
}
when HTTP_REQUEST {
log loca0. "Request from host: [HTTP::host]"
if {[string tolower [HTTP::host]] ends_with [lindex $redirect_list 0]} {
set newHost [string map $redirect_list [HTTP::host]]
log local0. "Host contains test1.com, redirecting to https://$newHost[HTTP::uri]"
HTTP::respond 301 Location https://$newHost[HTTP::uri]
} else {
log local0. "Host: [HTTP::host] does not match the condition"
}
}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