Fixed Last Modified HTTP Header in CSS

Marcus

Well-known member
The CSS files produced from XenForo don't get the correct last modified http header value. XenForo\CssOutput::displayCss() returns "Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT" despite:
PHP:
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->_styleModifiedDate) . ' GMT')

Quick fix to change it to page generation time:
PHP:
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');

The Cache-Control header could include the max-age attribute, as the Expires header is already setup to 2020. Adding an ETag (Enable ETag support for CSS Resource) would be great, too.
 
Last edited:
This behavior appears to be specific to when the CSS cache is enabled. In this case, we now use the input last modified date to build the header.
 
Back
Top Bottom