Forum Discussion
hooleylist
Oct 22, 2008Cirrostratus
Hi Dave,
You should be able to post the rule and preserve the spacing using [ code ] [/ code ] tags (without the spaces):
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
}
The rule looks fine. Are there any other iRules enabled on the VIP? Is the VIP a standard TCP VIP with an HTTP profile?
How often do you see the TCL error? If you are able to reproduce it or it happens often enough that you could capture a tcpdump you could open a case with F5 Support and ask them to investigate. You can use catch (Click here) to trap the error and log details on the client request:
Replace this line:
HTTP::header insert X-Japan-IP N
With this line:
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]"
}
Aaron