문제

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