質問

I want to update the expiry date for my content when my content is not modified so the user continues to use the browser cache without hitting my website just to receive a 304 status code.

In php I am producing the following:

     header('HTTP/1.0 304 Not Modified');
     $expires = date( 'D, d M Y H:i:s \G\M\T', $a_time);
     header( "Expires: $expires" );

However, in chrome, the network tab in devtools is showing a 304 status but no other headers. I've head that when sending a 304 error code, it's not possible to return other headers. Is this true?

役に立ちましたか?

解決

Apache strips out all non standard headers that accompany a 304 status code. So if you're trying to test if your functions work by creating headers such as header( 'test:test' ) this will fail. Expires works fine though.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top