Forum Discussion

cory_hase_69275's avatar
cory_hase_69275
Icon for Nimbostratus rankNimbostratus
Jul 14, 2008

Compression during a M-F 8am-5pm CST window

Can any one tell me if I can enable compression for a VIP via an Irule that will compress for periods of time, based on the local time of the LTM. Like compress duing the day 8-5 else do not compress.

 

 

 

Thanks in advance

2 Replies

  • How about something like this:

     
     when HTTP_RESPONSE { 
       set time_r [split [clock format [clock seconds] -format {%H:%M} ] " "] 
       set time_f [expr [expr [lindex $time_r 0]*100] + [lindex $time_r 1]] 
       if { not(($time_f >= 0800) && ($time_f <= 1700)) } { 
         COMPRESS::disable 
       } 
     } 
     

    I don't have compression module, so this is untested.
  • Darrell_Kesti_5's avatar
    Darrell_Kesti_5
    Historic F5 Account
    Seeing an error when trying to save this in the iRule editor

     

     

    when CLIENT_ACCEPTED {

     

    set time_r [split [clock format [clock seconds] -format {%H:%M} ] " "]

     

    set time_f [expr [expr [lindex $time_r 0]*100] + [lindex $time_r 1]]

     

    if { not(($time_f >= 0800) && ($time_f <= 1700)) } {

     

    set compression "off"

     

    }

     

    }

     

     

    when HTTP_RESPONSE {

     

    if { $compression eq "off" } {

     

    COMPRESS::disable

     

    }

     

    }

     

     

    line 3: [use curly braces to avoid double substitution] [[expr [lindex $time_r 0]*100]]

     

    line 3: [use curly braces to avoid double substitution] [[lindex $time_r 0]*100]

     

    line 4: [parse error: PARSE badNumber 187 {expected integer but got "0800" (looks like invalid octal number)}] [{ not(($time_f >= 0800) && ($time_f <= 1700)) }]