This happens when eg WordPress might be triggering a notice before we do the "readfile" in which case the notice will be mixed with the gzipped content in the response and therefore the browser cannot read the gzipped JS/CSS. You can easily reproduce this by eg replacing the
ob_get_clean with an
Something I don't quite understand yet is why it works when echoing something after the
_readfile. In theory we would need to exit right away.