In IIS 7.5 Ho impostato il cacheControlMaxAge ad essere di un anno in questo modoIIS7 cacheControlMaxAge non attributo di lavoro
<location path="Content/Images">
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
</location>
Secondo questa guida: Setting Expires and Cache-Control: max-age headers for static resources in ASP.NET
Tuttavia, lo strumento di Google Page Speed è ancora dicendo che la i file non vengono memorizzati nella cache:
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
* https://local.example.com/Content/Images/image1.png (expiration not specified)
(etc)
Perché si dice "scadenza non specificata"?
L'intera webapp viene pubblicata su https, è un fattore?
Avete ispezionato le intestazioni http per image1.png? Puoi farlo negli strumenti di sviluppo del tuo browser (F12 in Chrome/FF/IE), nella scheda di rete. Oppure puoi usare Fiddler. Tutti i browser moderni nascondono gli elementi tramite https se è impostata l'età massima. –
Le intestazioni http dicono 'Cache-Control: public' ma nessuna menzione di scadenza, come si chiamerebbe l'intestazione di scadenza? –
Risolto: aggiungendo gli attributi di caching a 'location path =" Content "' invece di 'location path =" Content/Images "' risolto il problema. –