HTTPS images are not cached

I am having problems caching images in my web application. Images are cached after the update, but when I open the browser again, it is no longer cached. I use HTTPS, but I'm not sure if this is a problem. This is the response from the server:

Response Headers
Accept-Ranges: bytes
Cache-Control: public
Connection: close
Content-Length: 3711
Content-Type: image/png
Date: Mon, 21 May 2012 14:08:46 GMT
ETag: "446b5-e7f-4c0559b8c1c9f"
Expires: Wed, 20 Jun 2012 14:08:46 GMT
Last-Modified: Fri, 18 May 2012 20:43:41 GMT
Server: Apache/2.2.22 (Amazon)

And our httpd.conf

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
    ServerName [REMOVED]

        RewriteEngine on
        ReWriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>

<VirtualHost *:443>

ServerName [REMOVED]

#Force image type
AddType image/png .png
AddType image/jpeg jpeg jpg jpe
AddType font/x-woff .woff

#Cache
ExpiresActive On
ExpiresDefault A0
<FilesMatch "\.(png|jpg|jpeg|gif)$">
    ExpiresDefault "access plus 1 month"
    Header set Cache-Control "public"
</FilesMatch>

#Logs
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

#SSL
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile [REMOVED]
SSLCertificateKeyFile [REMOVED]
SSLCertificateChainFile [REMOVED]
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

#Proxy
    DocumentRoot [REMOVED]

    ProxyPreserveHost On
    ProxyRequests Off

    ProxyPass [REMOVED] http://localhost:8081/[REMOVED]
    ProxyPassReverse [REMOVED] http://localhost:8081/[REMOVED]

    ProxyPassReverseCookiePath [REMOVED] /

    Alias [REMOVED] [REMOVED]

</VirtualHost>

Any clue? Thank!

+3
source share
1 answer

The headings are fine. Cache-Control: publicand the future Expiresmust do the work.

It seems like the browser’s decision not to store the cache permanently (such paranoia about HTTPS data is typical), and I don’t think you can do something about it.

+2
source

All Articles