Forum Discussion

Laurie_Swan_112's avatar
Laurie_Swan_112
Icon for Nimbostratus rankNimbostratus
Jan 17, 2006

Error running payload rewrite script

I've just tried cut-n-pasting the payload rewrite script at http://devcentral.f5.com/Default.aspx?tabid=29&ArticleType=ArticleView&ArticleID=56&PageID=61

 

, with just the find and replace variables changed to something more appropriate. However I get the following in the log:

 

 

TCL error: Rule payload_https_testportal - Operation not supported (line 1) invoked from within "HTTP::header replace "Connection" "Keep-Alive""

 

 

We're running BIG-IP LTM 9.0.4 Build 118.5. If I remove the entire HTTP::version stuff to add the keepalive then the script doesn't do anything at all.

 

 

I'm just looking for a way to change the http's in the output web page to https.

 

 

Any ideas??

 

Laurie

 

 

  • Ok, we have progression, but am still having problems.

    I now manage to tweak and get the script running intermittantly. I'm getting a strange HTTP:payload error/quirk. The HTTP_RESPONSE and HTTP_RESPONSE_DATA sections are as follows:

    
    when HTTP_RESPONSE {
       set clen [HTTP::header Content-Length] 
       if { not [info exists clen] or "0" eq $clen} { 
         set clen 4294967295
       } 
      log local0. "HTTP_RESPONSE CLEN= $clen -End"
      if { $clen > 0 } {
        HTTP::collect $clen
      }
    }
    when HTTP_RESPONSE_DATA {
      set find "findstring" 
      set replace "replacestring"
      set payload "[HTTP::payload]"
    log local0. "Payload [HTTP::payload length] [string length "[HTTP::payload]"] [string length $payload]"
       Run the regsub to make all the replacements (add -nocase for case insensitivity)
      if {[regsub -all $find $payload $replace new_response] > 0} {
        HTTP::payload replace 0 [HTTP::payload length] $new_response
      }
    }

    I'm sometimes getting in the log:

    Jan 18 11:55:42 tmm tmm[671]: Rule payload_https_testportal : HTTP_RESPONSE CLEN= 16175 -End
    Jan 18 11:55:42 tmm tmm[671]: Rule payload_https_testportal : Payload 16175 16175 16175

    Which is correct. But I'm often getting an incorrect:

    Jan 18 11:50:16 tmm tmm[671]: Rule payload_https_testportal : HTTP_RESPONSE CLEN= 16175 -End
    Jan 18 11:50:16 tmm tmm[671]: Rule payload_https_testportal : Payload 16175 115 115

    which means ny regsub doesnt work.

    Why does [HTTP::payload length] and [string length "[HTTP::payload]"] differ?? Is this a memory issue?