Forum Discussion

Joel_Newton's avatar
Oct 19, 2016

iRule gets cached and executes when it shouldn't

I have a maintenance iRule I apply to certain virtual servers during downtime operations. It uses the 'when HTTP_REQUEST' event and writes out the HTML for the page being displayed to the end user.

 

The problem is that even after the iRule has been removed from the virtual servers, it will still occasionally fire and display this maintenance HTML. This happens across browser sessions, across computers and across networks.

 

Even stranger, I have tried making a change to the HTML the iRule displays, after it has been removed from the virtual servers, and the change isn't shown in the browser so it appears the contents of the iRule is cached somewhere. However, I know that it's not simply a matter of the static page contents being cached because I've included a dynamic datetime stamp that the iRule generates, and this is consistently updated.

 

If it were only happening in the same browser session, that would make sense, but it's not. Any time I've looked at the RAM cache, it's been empty. I'm not sure where else I should be checking. Thanks.

 

7 Replies

  • Hello Joel,

    Can you share one line from your iRule, the HTTP::respond function which responds with HTML content? You may replace the HTML code with a placeholder but I'd like to see if you include any headers.

    • Joel_Newton's avatar
      Joel_Newton
      Icon for Cirrus rankCirrus

      Hi, Hannes! I hope things are well with you. Here's the gist of the HTTP::respond:

       

       HTTP::respond 200 content " ... ..." "Cache-Control" "no-cache, no-store, must-revalidate, max-age=0" "Edge-Control" "no-store,downstream-ttl=-1" "Pragma" "no-cache" "Expires" "-1"
      

       

    • Hannes_Rapp's avatar
      Hannes_Rapp
      Icon for Nimbostratus rankNimbostratus

      Thanks for the reference. I've provided an example of my own. Such use of headers should address your problem regardless of circumstances. Some headers from your current solution are too bulky and provide no added value, but I think the real problem is the absence of Connection Close header. You want to add this to any HTTP response functions in your maintenance iRule.

       

      HTTP::respond 200 content "html..." Cache-Control no-cache Pragma no-cache Connection Close
      

       

      If after this update the issue prevails, you must do a one-time clean up of all active connections on that VS.

      tmsh delete sys conn cs-server-addr YourVS-IP cs-server-port YourVS-port

       

      Regards,

    • Joel_Newton's avatar
      Joel_Newton
      Icon for Cirrus rankCirrus

      Thanks, Hannes. This definitely feels like progress. I was able to get the desired behavior with the following headers:

       

      "Cache-Control" "no-cache" "Pragma" "no-cache" "Connection" "Close" "Edge-Control" "no-store,downstream-ttl=-1"

       

      One thing I noticed, though, was that if I used the 'event disable' command after setting the headers, and then make a 'event HTTP_REQUEST enable' call as part of the HTTP_RESPONSE, I might still see the problem. The desired behavior is that only this maintenance iRule fire and all others be disabled, but I'm thinking that doing an 'event disable' isn't the correct way. Any thoughts, or is this question scope creep? 🙂 Or does the Connection Close header preclude any other iRules from executing in the same session?