Forum Discussion

Korai_331784's avatar
Korai_331784
Icon for Altostratus rankAltostratus
Jun 08, 2018

HTTP Header Cache Control

Hi,

 

I have below HTTP header irule script , we have Caching issue as when we move site from maintenance page to live site still but still maintenance page exists which we think its because of cache and to fix this we created below script but getting format error when applying this.

 

Please confirm if this HTTP Header Cache script is correct or we needs to do any changes.

 

when HTTP_REQUEST { HTTP::respond200 content {

 

 

Adviser Portal

The Adviser portal is currently unavailable due to scheduled maintenance.

 

The site will be unavailable on Saturday 11th of October. We apologise for any inconvenience.

 

} Cache-Control: no-cache

 

Pragma: no-cache

 

Connection: close }

 

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    This is what I use:

    when HTTP_REQUEST {
        set mytime [clock seconds]
        set last_modified "[clock format $mytime -format {%a, %d %b %Y %T %Z} -gmt 1]"
        set cache_control_1 "no-store, no-cache, must-revalidate, max-age=0"
        set cache_control_2 "post-check=0, pre-check=0, false"
        set pragma "no-cache"
    
        HTTP::respond 503 content {
            
               
                  Service Outage Notice
               
               
                  This service is currently under maintenance.
               
            
        } "Content-Type" "text/html" "Last-Modified" $last_modified "Cache-Control" $cache_control_1 "Cache-Control" $cache_control_2 "Pragma" $pragma Connection close
    }
    

    .