how to use control-cache headers?

前端 未结 4 1257
南旧
南旧 2021-01-04 19:43

I downloaded Google speed tracer for Google chrome to see how my site does performance wise and it tells me I need to enable caching for certain files like my style.css, ima

4条回答
  •  礼貌的吻别
    2021-01-04 20:25

    The key is must-revalidate: This means, that the client is asking the server if the file has changed. If you don’t handle this case, the browser will fetch a new copy.

    Read Mark Nottingham’s fantastic Caching Tutorial for more information. As an example for a PHP implementation you may use my code.

    Look into $_SERVER['HTTP_IF_NONE_MATCH']and $_SERVER['HTTP_IF_MODIFIED_SINCE'] for validating clients. And be aware that both headers may contain malicious code. ;)

提交回复
热议问题