2012-05-21 77 views
3

我在緩存我的web應用程序中的圖像時遇到了一些問題。圖片在刷新後被緩存,但是當我重新打開瀏覽器時,它不再被緩存。我正在使用HTTPS,但我不確定這是問題所在。這是從服務器的響應: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> 

任何線索?謝謝!

回答

2

標題很好。 Cache-Control: public和未來Expires應該完成這項工作。

它似乎是瀏覽器不會永久存儲緩存的決定(對於HTTPS數據而言,這種偏執是典型的),我不認爲你可以對此做任何事情。