Forum Discussion
Justin_Vo_48203
Nimbostratus
Jun 25, 2008redirect irule and log error
Hi,
I have a redirect iRule for http to https. It has been working for a while but now it doesn't redirect the browser. A packet capture indicate the virtual server return the redirection code 302 but then reset the connection straight away hence the browser display page can't be display. In the ltm log I get this message
Jun 21 03:46:09 tmm tmm[929]: 01220001:3: TCL error: Rule RedirectHTTP-to-HTTPS - Error: invalid log priority: (line 2) invoked from within "log local0. "redirect to https://[getfield [HTTP::host] ":" 1][HTTP::uri]""
This is my iRule
rule RedirectHTTP-to-HTTPS {
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
log local0. "redirect to https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
}
Is this a fault on the F5 or something I have done wrong, my version is 9.3.1 HF1 ? What I have is a virtual server with listen on http with this irule as the resource and another virtual server for HTTPS.
Thanks
Justin Vo
3 Replies
- Hamish
Cirrocumulus
Either fix your log line to include a priority (i.e. facility.priority vs facility.) or comment it out. The fault is in your iRule missing the facility on the log statement.
IIRC you could get away with this in 9.1.x (Possibly even 9.3.0), but from memory it gets a bit tighter on syntax in later versions... (Actually I think under 9.4 it won't even load the config). - Colin_Walker_12Historic F5 AccountThis looks like an issue with quotes. Make sure to escape all the quotes in the line you want logged with a \, otherwise they're going to terminate your log line.
Like this:log local0. "redirect to https://[getfield [HTTP::host] \":\" 1][HTTP::uri]"
Colin - Justin_Vo_48203
Nimbostratus
Thank you both for your reply. Just add to this, when I did a reload of the configuration by "b load", the problem seem to disappear. Any explanation to this ?
Anyway I put the "\" in front of the quotation and also specify the priority in the log command. I'll keep an eye on this to see if the problem re-appear. Thanks again for the pointers.
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