Forum Discussion
Phil_Rudich_735
Nimbostratus
Dec 05, 2007Redirect Issue
Having a small issue with my iRule. We are trying to first redirect any request that come in on port 80 to use https, then perform a host replace (see code below). However, when I hit the site, some...
hoolio
Cirrostratus
Dec 05, 2007With a default configuration, TCL errors from iRules will be logged to /var/log/ltm. If you're not seeing an error with TCL in the error text, it's probably not the rule generating the error.
Can you add log statements and reproduce the problem? The log output will be to /var/log/ltm.
when HTTP_REQUEST {
log local0. "Client [IP::client_addr]: requested [HTTP::host][HTTP::uri]"
if { [TCP::local_port] == 80 }{
log local0. "Client [IP::client_addr]: requested via port 80, redirecting to https"
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} elseif { [HTTP::host] equals "www.xxx.company.com"}{
log local0. "Client [IP::client_addr]: client requested [HTTP::host], updating to zzz.company.com"
HTTP::header replace "Host" "zzz.company.com"
if {not ([HTTP::uri] starts_with "/FOO")}{
switch -glob [HTTP::uri] {
/ -
/images/* -
/bin/* {
log local0. "Client [IP::client_addr]: rewriting URI to /FOO[HTTP::uri]"
HTTP::uri "/FOO[HTTP::uri]"
}
}
}
}
}Aaron
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
