Forum Discussion

David_Noonan_67's avatar
David_Noonan_67
Icon for Nimbostratus rankNimbostratus
Oct 21, 2008

iRule 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

2 Replies

  • 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
  • You should be able to post the rule and preserve the spacing using [ code ] [/ code ] tags (without the spaces):

     

     

    I did that and it spit up on me. I was in a hurry so I didn't bother checking further.

     

     

    The rule looks fine. Are there any other iRules enabled on the VIP? Is the VIP a standard TCP VIP with an HTTP profile?

     

     

    It's a TCP VIP with an HTTP profile. It has one other iRule that's applied before the one giving errors. It's shown below.

     

     

    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 
       } 
      } 
     } 
     

     

     

    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:

     

     

    I haven't been able to reproduce it and the logs show only 18 errors today so it's not happening very often. We actually had the active BigIP in a pair fail the other day and support noticed the error in the logs. I'd noticed it about a week earlier but hadn't got around to investigating yet. I don't believe it's related to the crash but they mentioned it and since you guys are always fast, friendly and helpful I thought I'd ask here after the things I tried didn't help.

     

     

    I'll try catch and see what that tells me.

     

     

    Thanks,

     

    Dave