Forum Discussion

Puli's avatar
Puli
Icon for Nimbostratus rankNimbostratus
Oct 28, 2009

How to remove Cache-Control from the header

Hi,

 

 

we wanted to remove the Cache-Control from HTTP Response.

 

using below code but does not work.

 

I can still see a Status code as 200.

 

 

if { [HTTP::uri] == "/.img" } {

 

set remove_cache_control_header 1

 

}

 

 

when HTTP_RESPONSE {

 

if { $remove_cache_control_header == 1 and [HTTP::header exists Cache-Control] } {

 

HTTP::header remove "Cache-Control"

 

}

 

}

 

 

Can you please suggest

2 Replies

  • Puli: could you paste a header dump of this traffic? I would add some logging to the HTTP_RESPONSE event to log the value of Cache-Control before you scrub it. Then confirm your browser doesn't see this header.

     

     

    A 200 response isn't a valid indicator of whether or not this header was removed, so it's best to look at the HTTP headers to be sure.

     

     

    -Matt
  • In addition to Matt's helpful suggestions, you might double check the URI you're looking for in the HTTP_REQUEST event. Did you just put /.img to anonymize the iRule or is that what you're using?

     

     

    Aaron