Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 74409 invoked from network); 24 Oct 2007 10:39:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Oct 2007 10:39:34 -0000 Received: (qmail 53987 invoked by uid 500); 24 Oct 2007 10:39:10 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 53970 invoked by uid 500); 24 Oct 2007 10:39:10 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 53958 invoked by uid 99); 24 Oct 2007 10:39:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2007 03:39:10 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.17.74.130] (HELO mta.magicsoftware.com) (193.17.74.130) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2007 10:39:14 +0000 To: users@httpd.apache.org MIME-Version: 1.0 From: uri_shaked@magicsoftware.com Message-ID: Date: Wed, 24 Oct 2007 12:37:00 +0200 Content-Type: multipart/alternative; boundary="=_alternative 003A4FDD4225737E_=" X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] Avoiding conditional requests --=_alternative 003A4FDD4225737E_= Content-Type: text/plain; charset="US-ASCII" 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 --=_alternative 003A4FDD4225737E_= Content-Type: text/html; charset="US-ASCII"
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
--=_alternative 003A4FDD4225737E_=--