Forum Discussion

Gerardo_Garcia_'s avatar
Gerardo_Garcia_
Icon for Nimbostratus rankNimbostratus
May 21, 2008

meta refresh to 302s

I have the following iRule

 

However sometimes we receive the following error

 

 

Do you know why?

 

 

May 20 10:56:32 tmm tmm[1019]: 01220001:3: TCL error: Rule refresh_to_redirect_4 - Operation not supported (line 8) invoked from within "HTTP::header replace "Connection" "Keep-Alive""

 

 

 

iRule to convert meta refresh statements to 302s

 

 

when HTTP_REQUEST

 

{

 

if {[HTTP::uri] contains ".pt?"}

 

{

 

set checkContents 1

 

if {[HTTP::version] eq "1.1"}

 

{

 

if { [HTTP::header is_keepalive] }

 

{

 

HTTP::header replace "Connection" "Keep-Alive"

 

}

 

HTTP::version "1.0"

 

}

 

}

 

else

 

{

 

set checkContents 0

 

}

 

}

 

when HTTP_RESPONSE

 

{

 

if {($checkContents>0) and ([HTTP::header Content-Type] starts_with "text/html") and ([HTTP::header exists "Content-Length"])}

 

{

 

set content_length [HTTP::header "Content-Length"]

 

if {($content_length>=400) and ($content_length<=600)}

 

{

 

HTTP::collect $content_length

 

}

 

else

 

{

 

set checkContents 0

 

}

 

}

 

}

 

when HTTP_RESPONSE_DATA

 

{

 

if {($checkContents>0) and ([HTTP::payload] contains "meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;")}

 

{

 

set urlresponse [findstr [HTTP::payload] "URL=" 4 {">}]

 

if {$urlresponse!=""}

 

{

 

HTTP::payload replace 0 $content_length [format "" $urlresponse]

 

HTTP::release

 

}

 

}

 

}

 

2 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Off the top of my head I'd guess that some of the traffic is missing a Connection header and the command is erroring out with a message that's less than appropriate. I'd try adding some logging statements around the line in question to see what's coming through when you see those errors.

     

     

    Colin
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I think HTTP::header replace will just insert the header if it doesn't exist already and not generate an error. Iis there another iRule on the VIP which is issuing a redirect or otherwise conflicting with the HTTP header replace command?

     

     

    Aaron