Forum Discussion

Wil_Schultz_101's avatar
Wil_Schultz_101
Icon for Nimbostratus rankNimbostratus
Oct 09, 2007

irule doesn't work after upgrade...

Hey there, I have the following irule located in the cache example:

 

http://devcentral.f5.com/wiki/default.aspx/iRules/UsingIRulesToManipulateCache.html

 

 


when HTTP_REQUEST {
 set ::mytime [clock seconds]
}
when HTTP_RESPONSE {
 HTTP::header insert Last-Modified "[clock format $::mytime -format "%a, %d %b %Y %T %Z"]"
 HTTP::header insert Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
 HTTP::header insert Cache-Control "post-check=0, pre-check=0, false"
 HTTP::header insert Pragma "no-cache"
}

 

 

I wrote the example wiki page and this rule seemed to work great in version 9.2.4.

 

 

I have some tickets opened with f5 support on some other issues and was asked to update the code to 9.3.0 HF2.

 

 

This irule still works, however somewhere along the way it appears as if this irule now prevents my pages from caching. I know for a fact that using this irule worked for me in the past (added headers, forced client browsers to refresh, and grab the current cached version of the page), but I can now prove that this indeed prevents all pages that these headers were inserted into do not make it to cache. All requests are currently hitting the origin servers.

 

 

Anyone here have any suggestions? or maybe some information on why this doesn't appear to have the same effect anymore?
  • Aren't you not cacheing because you already using HTTP::header insert Pragma "no-cache"?.

     

     

  • I should have updated a while ago.

    It appears as if there was a bug that would allow the F5 to cache these responses in previous versions. We used this iRule to tell the browser to tell the browser to return home but were able to keep the page in cache. This CR got resolved and then we found that the browser would return home and the page would never be in cache.

    The current functionality is that the BigIP will follow the last cache-control or pragma header it see's, so to have the same functionality I just added an erroneous header afterwards so it looks more like this:

    
    when HTTP_REQUEST {
     set ::mytime [clock seconds]
    }
    when HTTP_RESPONSE {
     HTTP::header insert Last-Modified "[clock format $::mytime -format "%a, %d %b %Y %T %Z"]"
     HTTP::header insert Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
     HTTP::header insert Cache-Control "post-check=0, pre-check=0, false"
     HTTP::header insert Pragma "no-cache"
     HTTP::header insert Pragma "dont cache me please"
    }
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    A minor suggestion, wschultz:

     

     

    Your ::mytime varaible is global and would be overwritten by any other HTTP request. It would be cleaner to use a local variable if you want the time to be specific to the particular HTTP request.

     

     

    Aaron