Chrome and Opera do not respect the cache

4

Chrome and Opera (same engine as the first one) do not respect the headers Cache-control and Expires , I mean if it's a link or an interaction within the works normally page, this appears to front:

Butiftherequestcomesfrombrowserfavoritesitsimplyignoresthecache:

It'salmostlikeI'vepressedF5(ormaybeit'sthesamebehavior),inFirefoxtheproblemdoesnotoccur,onlyinChromeandOperaitself.

Thetestcodewasthis:

<?php $seconds = 360; // uma hora de cache header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $seconds) . ' GMT', true); header('Cache-Control: public, max-age=' . $seconds, true); header('Pragma: max-age=' . $seconds, true); $atual = gmdate('D, d M Y H:i:s'); //Ultima modificação é considerado a hora do acesso header('Last-Modified: ' . $atual . ' GMT', true); ?> <a href="pagina.php">Recarregar</a><br> <?php echo $atual; ?>
  

This is not a problem with PHP, just use it to test the headers

Is there any way to indicate to the browser through the headers that the cache should "have preference" or is this indeed a Bug ?     

asked by anonymous 05.04.2017 / 19:08

0 answers