Forum Discussion

Emre_27149's avatar
Emre_27149
Icon for Nimbostratus rankNimbostratus
May 22, 2011

persistansy and compression

Hi,

 

I need to your ideas .We tested the bellow irules and it worked.But after get the production some clients complained session persistent and compression.There is a relationship persistency rule that if cookie is disabled then are used session id for persestancy. We compress all file types except msie 6 and some compressed file types.

 

Thank you.

 

 

 

persistency rule

 

when HTTP_REQUEST {

 

if { [HTTP::cookie "BSESSIONID"] ne ""} {

 

persist uie [string tolower [HTTP::cookie "BSESSIONID"]]

 

log local0. "deneme"

 

}

 

else {

 

set bsess [findstr [string tolower [HTTP::path]] "bsessionid=" 11 ""]

 

if { $bsess != ""} {

 

persist uie $bsess

 

log local0. "deneme2"

 

}

 

}

 

}

 

 

when HTTP_RESPONSE {

 

if {[HTTP::cookie "BSESSIONID"] ne ""} {

 

persist add uie [string tolower [HTTP::cookie "BSESSIONID"]]

 

log local0. "deneme3"

 

}

 

}

 

 

 

 

compression rule

 

when HTTP_REQUEST {

 

if { [HTTP::header User-Agent] contains "MSIE 6" }

 

{

 

log local0. "Header agent [HTTP::header User-Agent] NOT COMPRESSED"

 

COMPRESS::disable

 

event disable all

 

}

 

else

 

{

 

log local0. "Header agent [HTTP::header User-Agent] COMPRESSED"

 

COMPRESS::enable }

 

}

 

when HTTP_RESPONSE {

 

if {[HTTP::header Content-Type] contains "png" ||

 

[HTTP::header Content-Type] contains "jpg" ||

 

[HTTP::header Content-Type] contains "jpeg" ||

 

[HTTP::header Content-Type] contains "exe" ||

 

[HTTP::header Content-Type] contains "swf" ||

 

[HTTP::header Content-Type] contains "flw" }

 

{ log local0. "Header agent [HTTP::header Content-Type] PNG NOT COMPRESSED"

 

COMPRESS::disable

 

}

 

else

 

{

 

log local0. "Header agent [HTTP::header Content-Type] OTHERS COMPRESSED"

 

COMPRESS::enable }

 

}

 

 

2 Replies

  • If you call 'event disable all' it will prevent any further iRule events from being run for the rest of the connection. That would break any further persistence on the connection.

    Can you try this instead:

    when HTTP_REQUEST {
       if { [HTTP::header User-Agent] contains "MSIE 6" }{
          log local0. "Header agent [HTTP::header User-Agent] NOT COMPRESSED"
          set disable 1
       } else {
          log local0. "Header agent [HTTP::header User-Agent] COMPRESSED"
          set disable 0
       }
    }
    when HTTP_RESPONSE {
    
        Exit this event in this iRule if we're disabling compression for IE6
       if {$disable==1}{
          COMPRESS::disable
          return
       }
       switch -glob [HTTP::header Content-Type] {
          "*png*" -
          "*jpg*" -
          "*jpeg*" -
          "*exe*" -
          "*swf*" -
          "*flw*" {
             log local0. "Header agent [HTTP::header Content-Type] PNG NOT COMPRESSED"
             COMPRESS::disable
          }
          default {
             log local0. "Header agent [HTTP::header Content-Type] OTHERS COMPRESSED"
             COMPRESS::enable
          }
       }
    }
    

    Aaron
  • Why NOT just use the services profiles to enable compression and specify the extensions it compresses?

     

     

    Regards,

     

    TRX