Forum Discussion

Craig_Freyman_1's avatar
Craig_Freyman_1
Icon for Nimbostratus rankNimbostratus
Oct 17, 2005

NO-Caching certain files with BIP

Trying to write an IRule to make client computers not cache certain file types. We can not have our client computers download any files that start with "slide" or "ps" into their temporary internet files.

 

 

I have tried the following however the files are still caching into the Temp internet files.

 

 

when HTTP_REQUEST {

 

if {[HTTP::uri] contains "slide."} {

 

set foundmatch 1

 

}

 

if {[HTTP::uri] contains "ps."} {

 

set foundmatch 1

 

}

 

else {

 

set foundmatch 0

 

}

 

}

 

when HTTP_RESPONSE {

 

if {$foundmatch == 1} {

 

HTTP::header replace Cache-Control no-cache

 

HTTP::header replace Pragma no-cache

 

}

 

}

 

 

 

Any ideas out there???

 

 

Thanks!

 

14 Replies

  • I'll use that as a last resort. Still strange that when Apache interacts with HTTP 1.0 clients the client computers obey the Pragma: no-cache but when using BigIP they don't obey.

     

     

    Never heard from Bl0ndie -- any advice Bl0nd?
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    It looks like this is because BIG-IP is responding with an HTTP 1.0 connection to the client. You should be able to replace this info in the packet and try to convince the client to connect with an HTTP version 1.1 connection. If the negotiation is succesful, it should obey the no-cache header as normal.

    Try this inside the when HTTP_REQUEST event:

    
    HTTP::version "1.1"

    -Colin
  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    The cache control headers are correct according to RFC 1945 (HTTP/1.0 spec) so your client is probably the one at fault. Lets try setting the HTTP version to HTTP/1.1 on the response and see what happens.

    
    when HTTP_RESPONSE {
     HTTP::version "1.1"
    }
  • Yessssssssss.

     

     

    Thanks a million - that worked.

     

     

    Here is the final rule.

     

     

    when HTTP_REQUEST {

     

    set foundmatch 0

     

    if { ([HTTP::uri] contains ".swf") or ([HTTP::uri] contains "ps")} {

     

    set foundmatch 1

     

    }

     

    }

     

    when HTTP_RESPONSE {

     

    if {$foundmatch == 1} {

     

    HTTP::version "1.1"

     

    HTTP::header replace Pragma no-cache

     

    HTTP::header replace Cache-Control no-cache

     

    HTTP::header replace Expires -1

     

    HTTP::header remove Connection

     

    HTTP::header insert Connection Close

     

     

    }

     

    }

     

     

    Thanks again for all your help!

     

     

    -Craig