Forum Discussion
David_Noonan_67
Nimbostratus
Oct 21, 2008iRule causing ltm errror message
The attachment contains an iRule (the forum didn't like it when I tried pasting it here) that's causing error messages in our ltm file.
The error messages look like this except I broke it up make it more legible.
Oct 21 12:55:41 tmm tmm(1684): 01220001:3:
TCL error: merlin_Set-Japan-Ip-Header -
Operation not supported (line 17)
invoked from within "HTTP::header insert X-Japan-IP N"
The class referenced in the iRule contains 1842 lines like this "network 58.0.0.0/15," that are IP subnets in Japan. The iRule sets a header if the source address is on one of those subnets so that the application can feed them a Japanese language page. I don't know why they didn't use the browser's language setting to do this.
If you've got any ideas for improving the iRule or fixing our problem I'd love to hear them.
Thanks,
Dave
- hoolio
Cirrostratus
Hi Dave,when RULE_INIT { 15 lines of comment removed } when HTTP_REQUEST { set jip "" if { [HTTP::uri] starts_with "/portal/server.pt" } { if { [HTTP::cookie exists "X-Japan-IP"] } { HTTP::header insert X-Japan-IP [HTTP::cookie value "X-Japan-IP"] } elseif { [HTTP::header exists "X-Forwarded-For"] } { if { ([matchclass [substr "[HTTP::header "X-Forwarded-For"]" 0 ","] equals $::Japan_IP]) } { HTTP::header insert X-Japan-IP Y set jip "Y" } else { HTTP::header insert X-Japan-IP N set jip "N" } } elseif { ([matchclass [IP::remote_addr] equals $::Japan_IP]) } { HTTP::header insert X-Japan-IP Y set jip "Y" } else { HTTP::header insert X-Japan-IP N set jip "N" } } } when HTTP_RESPONSE { if {$jip != ""} { HTTP::cookie insert name "X-Japan-IP" value $jip path "/" } unset jip }
HTTP::header insert X-Japan-IP N
if {[catch {HTTP::header insert X-Japan-IP N} result]}{ log local0. "[IP::client_addr]:[TCP::local_port]: Error: $result" log local0. "[IP::client_addr]:[TCP::local_port]: Error on [HTTP::request]" }
- David_Noonan_67
Nimbostratus
You should be able to post the rule and preserve the spacing using [ code ] [/ code ] tags (without the spaces):rule merlin_Redirect-www.globaloneteam.com { when HTTP_REQUEST { if { [HTTP::host] starts_with "www.globaloneteam.com" } { HTTP::redirect "https://www.ihgmerlin.com[HTTP::uri]" } else { pool merlin_Web_8000-1 } } }
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