Forum Discussion

Jason_40769's avatar
Jason_40769
Icon for Nimbostratus rankNimbostratus
Mar 30, 2012

no-cache Irule

We are wanting to force caching and set the maxage via an irule except on a certain link. We tried this rule but it doesnt seem to work ALL the time. Thoughts?

 

 

when HTTP_REQUEST {

 

DEFAULT cache value for all pages

 

set cache_value "public, max-age=300"

 

 

 

center should not be cached

 

if { [HTTP::uri] contains "/center" } {

 

set cache_value "private, no-cache"

 

}

 

}

 

when HTTP_RESPONSE {

 

HTTP::header replace Cache-control $cache_value

 

}

 

 

3 Replies

  • Hi Jason,

     

     

    That iRule looks fine. When you say it doesn't work all of the time what do you mean? Are you seeing some responses without the Cache-Control header set? If so, do you have fast cache or Web Accelerator enabled on the virtual server?

     

     

    Aaron
  • what happens is we see the "private" insert coming through most of the time but we also see a S-Cache tag through as well... which is strange.