Forum Discussion
Earnest_Dyke_10
Nimbostratus
Feb 16, 2006Simple IRule apparently not working
Greegings all.
We have the IRule below and when we install it and attempt to execute our web app, we see not messages in the log. We do not see any syntax errors messages either. Any ideas why we would be getting no output at all?
Thanks in advance for any and all help!
Earnie!
when RULE_INIT {
log local0. "Earnies rule is being initialized"
}
when HTTP_REQUEST {
Look of each entry in badurl in the URI
set uri [HTTP::uri]
log local0. "Checking uri: $uri"
set badurl [list "http://ww1:80" "https://ww1:80"]
foreach x $badurl {
if {$uri starts_with $x} {
set len [string length $x]
Get all of the URI after the port number
set resource [substr $uri $len]
set outlocation "https://ww1$resource"
log local0. "Changing request for $uri to $outlocation"
HTTP::uri $outlocation
break;
}
}
}
when HTTP_RESPONSE {
If this is not a browser redirect, igonore it
if {[HTTP::status] starts_with "3"} {
set location [HTTP::header "Location"]
if {$location == ""} {
return
}
} else {
return
}
log local0. "Checking location: $location"
Look of each entry in badurl in the redirect location
set badurl [list "http://ww1:80" "https://ww1:80"]
foreach x $badurl {
if {$location starts_with $x} {
set len [string length $x]
Get all of the URI after the port number
set resource [substr $location $len]
set outlocation "https://ww1$resource"
log local0. "Rewriting $location to $outlocation"
HTTP::header replace "Location" $outlocation
break;
}
}
}
- Colin_Walker_12Historic F5 AccountThere should definitely be some information sent to your log file with that rule in place, assuming you're hitting the VIP it's assigned to.
- Moritz_Möller_6
Nimbostratus
Do you have a oneConnect profile enabled? - Colin_Walker_12Historic F5 AccountIn this case, a ONECONNECT profile shouldn't make any difference over whether or not ANY log entries show up.
when RULE_INIT { log local0. "Earnies rule is being initialized" }
- Otto_Kretzer_68
Nimbostratus
Colin - Yes its the ltm log file im looking at, when we use the following code i get entries int he log file: - Colin_Walker_12Historic F5 AccountTo test this, I copied and pasted Earnie's rule, the one listed in the initial post, into my bigip.conf file. I then reloaded the configuration, and I did indeed see the log entry sent to the log file, as you can see below:
- Otto_Kretzer_68
Nimbostratus
what log file are you seeing this? I add the irule through the gui interface on f5 under Local traffic, irulelist. then the Irule is added to the virtual server it belongs to. I then check the ltm log file and the log file under the gui and see not entries at all on either the gui log or right in the ltm log file itself. - Moritz_Möller_6
Nimbostratus
maybe you have modified your syslog configuration? - Otto_Kretzer_68
Nimbostratus
I do see stuff in he ltm log now, didnt before but see some items now> when i did the b load from command line it seems to have worked. When i do the irule and click update from the gui it doesnt seem to work - unRuleY_95363Historic F5 AccountAh, you may be seeing CR54041 which can manifest itself as that an iRule doesn't appear to change when being modified via the GUI. You can check your hotfixes to see if that is included in your current version.
- William_Them_99
Nimbostratus
FYI - I've seen this happen lots and didn't know about the hotfix for it. A consistent workaround for me has been going back to the virtual server to which the iRule is attached and hitting "Update" there (even though there are no changes to the virtual server settings).
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