httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uri_sha...@magicsoftware.com
Subject [users@httpd] Avoiding conditional requests
Date Wed, 24 Oct 2007 10:37:00 GMT
Hi All,

I've been trying to improve my webapp's performance by telling Apache 
[2.2.4] to force clients to cache static content using mod_expires.
I'm basically trying to avoid having the client browser resend the 
'if-modified' conditional request for the static content upon a refresh or 
a revisit to the site, thus saving the round-trip time and having the page 
presented straight from cache . For this, I've added the following lines 
to my httpd.conf:

LoadModule expires_module modules/mod_expires.so
ExpiresActive on
ExpiresDefault "access plus 2 hours"
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType text/css "access plus 7 days"
ExpiresByType application/x-javascript "access plus 12 hours"

The problem is that for some reason this doesn't seem to work, and the 
browser [ie6] still sends the conditional requests, disregarding the 
expiration directive.
here is an example HTTP traffic caputre (using Fiddler): 

First Request

GET /Eip/Static/Images/Logos/siteLogo.gif HTTP/1.0
Accept: */*
Referer: http://qcxp2/Eip/bin/ibp.jsp?ibpPage=HomePage&
Accept-Language: he
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
InfoPath.1; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: qcxp2
Cookie: JSESSIONID=4662B8AA7EC6B9AE09258672CBDCE54C



First Response

HTTP/1.1 200 OK
Date: Wed, 24 Oct 2007 08:37:29 GMT
Server: Apache/2.2.4 (Win32) mod_jk/1.2.25
Last-Modified: Mon, 17 Sep 2007 09:00:24 GMT
ETag: "8e5a-782-8f6da00"
Accept-Ranges: bytes
Content-Length: 1922
Cache-Control: max-age=604800
Expires: Wed, 31 Oct 2007 08:37:29 GMT
Connection: close
Content-Type: image/gif

GIF89a]




Second Request (the one that souldn't actually occur at all)

GET /Eip/Static/Images/Logos/siteLogo.gif HTTP/1.0
Accept: */*
Referer: http://qcxp2/Eip/bin/ibp.jsp?ibpPage=HomePage&
Accept-Language: he
Proxy-Connection: Keep-Alive
If-Modified-Since: Mon, 17 Sep 2007 09:00:24 GMT
If-None-Match: "8e5a-782-8f6da00"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
InfoPath.1; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: qcxp2
Pragma: no-cache
Cookie: JSESSIONID=4662B8AA7EC6B9AE09258672CBDCE54C



Second Response

HTTP/1.1 304 Not Modified
Date: Wed, 24 Oct 2007 08:41:12 GMT
Server: Apache/2.2.4 (Win32) mod_jk/1.2.25
Connection: close
ETag: "8e5a-782-8f6da00"
Expires: Wed, 31 Oct 2007 08:41:12 GMT
Cache-Control: max-age=604800


Any ideas?


Uri

Mime
View raw message