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, sometimes it comes up fine and other times we get a "page not found" error. It's not consistent and can't figure out if it's the code or a pool issue.
when HTTP_REQUEST {
if { [TCP::local_port] == 80 } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else
{
if { [HTTP::host] equals "www.xxx.company.com"} {
HTTP::header replace "Host" "zzz.company.com"
if { [HTTP::uri] starts_with "/FOO" } then
{
} else {
switch -glob [HTTP::uri] {
"/*" -
"/images/*" -
"/bin/*" {
HTTP::uri "/FOO[HTTP::uri]"
}
}
}
}
}
}
Please help!
Thanks,
Phil
8 Replies
Sort By
- hoolio
Cirrostratus
Hi, - Phil_Rudich_735
Nimbostratus
I'm not seeing anything relative in the logs. I may not have the necessary error tracking turned on... as I'm new to these LTM's. Please advise. - hoolio
Cirrostratus
With 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.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]" } } } } }
- Phil_Rudich_735
Nimbostratus
Here is a small blurb of what the log shows: - Phil_Rudich_735
Nimbostratus
I fixed the issue! Appeared to be a misconfiguration in DNS. - Phil_Rudich_735
Nimbostratus
Now having an additional issue with the iRule at the very top, that I'm hoping someone can assist with!! - hoolio
Cirrostratus
What is the hostname the client is making a request to? What is the CN of the certificate? It sounds like the two aren't the same, so the browser generates a hostname mismatch alert. - Phil_Rudich_735
Nimbostratus
The hostname of the actual server is memberc06.benelogic.com and it's a star certificate (*.benelogic.com). I just spoke with Microsoft and they explained to me that one of the rules for star-certs is that they can't go more than three deep with the name. So, for instance, www.XXX.benelogic.com would not be acceptable... only if I purchased a cert for that specific name. And since we are performing a host replace, IE still thinks its the original which is not acceptable by they star-cert standards.
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