Cache Control fails

前端 未结 2 1948
隐瞒了意图╮
隐瞒了意图╮ 2021-01-25 00:08

My index.php page keeps being cached, showing old timer values and others, even though I\'m using this:

session_cache_limiter( \'nocache\' );
session_start( );
h         


        
相关标签:
2条回答
  • 2021-01-25 00:32

    Set the cache expiration date to an old date.

    header( 'Expires: Fri, 01 Jan 2010 00:00:00 GMT' );
    
    0 讨论(0)
  • 2021-01-25 00:34

    Headers output in FireFly is still Cache-Control private, max-age=10800, pre-check=10800, no-cache, must-revalidate, post-check=0, pre-check=0

    This implies that since you are setting this:

    Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
    

    Some other component/configuration in your app/page is setting this:

    Cache-Control: private, max-age=10800, pre-check=10800
    

    and both are sent to the end user. The "Cache-Control: private" overrides your values when browser reads them, causing the page to be cached.

    Note: header() will by default override any headers that are previously set, so it might be that something is setting that after your line of code, since your line should override any previous ones.

    You need to find out what is setting those "private" cache-control headers and disable/comment that, otherwise it will not work. Maybe some other section later in your code?

    0 讨论(0)
提交回复
热议问题