3

我在我的网络应用程序上缓存图像时遇到了一些问题。刷新后图像被缓存,但是当我重新打开浏览器时,它不再被缓存。我正在使用 HTTPS,但我不确定是不是问题所在。这是来自服务器的响应:

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)

还有我们的 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>

有什么线索吗?谢谢!

4

1 回答 1

2

标题很好。Cache-Control: public和未来Expires应该做的工作。

似乎是浏览器决定不永久存储缓存(这种对 HTTPS 数据的偏执是典型的),我认为您对此无能为力。

于 2013-02-17T19:33:43.730 回答