Ubuntu – apache tomcat IE caching problem

apache-2.2cacheinternet explorertomcat6Ubuntu

I'm running apche2 and tomcat6 both on port 80 with mod_jk setup on ubuntu servers(8.10,9.10). Tomcat is being used for serving jsp pages. I've a small problem with the IE browser which doesn't cache but just reload all the images(jpg|png|css) when refreshed the page which is not happing with the other browsers. I also tried appending the following in the apache config file but no change.

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/css "access plus 1 month"
    ExpiresByType text/html "access plus 1 month"
 </IfModule>

/etc/apache2/apache2.conf file:

Alias / /var/www/
ErrorDocument 503 /maintenance.html
ErrorDocument 404 /maintenance.html
JkMount / myworker
JkMount /* myworker
JkMount /*.jsp myworker
JkUnMount /*.html myworker


<VirtualHost *:80>
ServerName station1.mydomain.com
DocumentRoot /usr/share/tomcat/webapps/myapps1
        JkMount /* myworker
        JkUnMount /*.html myworker
</VirtualHost>


<VirtualHost *:80>
ServerName station2.mydomain.com
DocumentRoot /usr/share/tomcat/webapps/myapps2
        JkMount /* myworker
    JkMount /*.html myworker
</VirtualHost>

Anybody has any trick to make IE cache and not to reload all the images everytime?

Best Answer

We didn't have much luck getting IE to cache until adding something like this to the apache configuration for files matching images and stylesheet extensions:

Header add Cache-Control "max-age=28800, public"

Related Topic