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.
Can I return other headers with a 304 status code?
-
07-10-2022 - |
Question
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?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow