Hi F5beginner,
the chances are high that the redirect in your LTM Policy is interfering with the subsequent iRule execution. Keep in mind that the LTM Policies are processed always first and you cant change the priority so that the iRule will be processed before LTM Policies.
As an easy fix you may want to wrap your iRule logic into a catch { } command to supress the TCL error whenenver the iRule is unable to execute the redirect.
when HTTP_REQUEST {
catch {
# Check if the host starts with www.
if {[string tolower [HTTP::host]] starts_with "www."}{
# Redirect with the www. prefix removed to the same URI
HTTP::redirect "http://[string range [HTTP::host] 4 end][HTTP::uri]"
}
}
}
A slightly more complex (but cleaner) fix, would be to migrate your tasks so that they would either use LTM Policies or iRule but not both at the same time...
Cheers, Kai