开发者

Can HTTP 304 message be avoided?

开发者 https://www.devze.com 2023-02-19 17:46 出处:网络
When using Codeigniter or a simple php pag开发者_运维百科e, loadin my test page once I get the normal 200 status but if it is cached I get the 304 message. I realize this is just a signal that the res

When using Codeigniter or a simple php pag开发者_运维百科e, loadin my test page once I get the normal 200 status but if it is cached I get the 304 message. I realize this is just a signal that the resource is cached but could I avoid it? If so, how? Thank you.


... or you could just do

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

in your PHP files right at the top. That way you have control over which pages not to cache and leave Apache running as it should.


If you don't want the page to be cached by browsers you need to configure the apache server to send the appropriate headers.

0

精彩评论

暂无评论...
验证码 换一张
取 消