You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Yuan HOng <ho...@gmail.com> on 2008/02/25 07:26:48 UTC

[users@httpd] Problem with mod_deflate and IE6 javascript caching

Hi, list,

I have a large javascript file which I want to send to IE6 gziped and
for IE6 to cache.

I set the following derective in the configuration file:

AddOutputFilterByType DEFLATE application/x-javascript

The result is but that IE6 doesn't cache the javascript.

Looking into the response headers, I found that apache is sending
Transfer-Encoding: chunked together with Vary: Accept-Encoding, but
without Content-Encoding: gzip

I think that the missing Content-Encoding: gzip might have to do with
IE6 not caching the Javascript. Does anybody have an idea about this?

By the way, I have read that Content-Encoding and Transfer-Encoding
are separate things, so I am expecting Apache to send
Transfer-Encoding together with Content-Encoding. Why is
Content-Encoding dropped?

Also, the 'chunked' transfer encoding is supposed to be used for
dynamically generated content. But my javascript file is a static one.
When does apache decide to use 'chunked' encoding? Can I force Apache
not to use 'chunked' encoding for gziped content?

Best Regards,

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Re: [users@httpd] Problem with mod_deflate and IE6 javascript caching

Posted by Yuan HOng <ho...@gmail.com>.
On Tue, Feb 26, 2008 at 1:41 AM, David Cassidy <da...@twocats.co.uk> wrote:
> How are you testing that this is working correctly ?
>
>  Are you using wget with the --header="Accept-Encoding: gzip"
>  to test it ?
>

On the IE6 side I installed IE HttpAnalyzer to inspect the request and
responses between IE and Apache.

With wget Apache doesn't send the javascript back using chunking, just
simply "Content-Encoding: gzip", as below:

Connecting to rhodium.homemaster.cn|192.168.0.2|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Tue, 26 Feb 2008 02:15:17 GMT
  Server: Apache/2.2.6 (Debian) mod_python/3.3.1 Python/2.4.4
PHP/5.2.4-2+b1 with Suhosin-Patch
  Last-Modified: Tue, 12 Feb 2008 07:34:35 GMT
  Accept-Ranges: bytes
  Cache-Control: max-age=315360000
  Expires: Fri, 23 Feb 2018 02:15:17 GMT
  Vary: Accept-Encoding
  Content-Encoding: gzip
  Connection: close
  Content-Type: application/x-javascript
Length: unspecified [application/x-javascript]

I guess that is due to wget not supporting content negotiation.

In IE6, the response header send back by Apache is follows:

(Status-Line):HTTP/1.1 200 OK
Date:Tue, 26 Feb 2008 02:16:25 GMT
Server:Apache/2.2.6 (Debian) mod_python/3.3.1 Python/2.4.4
PHP/5.2.4-2+b1 with Suhosin-Patch
Last-Modified:Tue, 12 Feb 2008 07:34:35 GMT
Accept-Ranges:bytes
Cache-Control:max-age=315360000
Expires:Fri, 23 Feb 2018 02:16:25 GMT
Vary:Accept-Encoding
----------------:----
Keep-Alive:timeout=15, max=97
Connection:Keep-Alive
Transfer-Encoding:chunked
Content-Type:application/x-javascript

It uses Transfer-Encoding:chunked instead of Content-Type:gzip. And
the script doesn't gets cached despite a far-future expires header.

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Re: [users@httpd] Problem with mod_deflate and IE6 javascript caching

Posted by Yuan HOng <ho...@gmail.com>.
On Tue, Feb 26, 2008 at 1:49 AM, yary <no...@gmail.com> wrote:
> Transfer encoding requires content negotioation, so maybe this will help:
>  http://httpd.apache.org/docs/2.0/content-negotiation.html#caching
>

Thanks for the hint. But the CacheNegotiatedDocs directive is only
effective for HTTP1.0 clients. Since IE6 uses HTTP1.1, it doesn't seem
to bear on my current problem.

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Re: [users@httpd] Problem with mod_deflate and IE6 javascript caching

Posted by yary <no...@gmail.com>.
Transfer encoding requires content negotioation, so maybe this will help:
http://httpd.apache.org/docs/2.0/content-negotiation.html#caching

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Problem with mod_deflate and IE6 javascript caching

Posted by David Cassidy <da...@twocats.co.uk>.
How are you testing that this is working correctly ?

Are you using wget with the --header="Accept-Encoding: gzip" 
to test it ?

D


On Mon, 2008-02-25 at 09:46 -0500, Joshua Slive wrote:
> 2008/2/25 Yuan HOng <ho...@gmail.com>:
> > Hi, list,
> >
> >  I have a large javascript file which I want to send to IE6 gziped and
> >  for IE6 to cache.
> >
> >  I set the following derective in the configuration file:
> >
> >  AddOutputFilterByType DEFLATE application/x-javascript
> >
> >  The result is but that IE6 doesn't cache the javascript.
> >
> >  Looking into the response headers, I found that apache is sending
> >  Transfer-Encoding: chunked together with Vary: Accept-Encoding, but
> >  without Content-Encoding: gzip
> >
> >  I think that the missing Content-Encoding: gzip might have to do with
> >  IE6 not caching the Javascript. Does anybody have an idea about this?
> >
> >  By the way, I have read that Content-Encoding and Transfer-Encoding
> >  are separate things, so I am expecting Apache to send
> >  Transfer-Encoding together with Content-Encoding. Why is
> >  Content-Encoding dropped?
> >
> >  Also, the 'chunked' transfer encoding is supposed to be used for
> >  dynamically generated content. But my javascript file is a static one.
> >  When does apache decide to use 'chunked' encoding? Can I force Apache
> >  not to use 'chunked' encoding for gziped content?
> 
> [Warning: these are mostly informed guesses. I'm not a gzip expert.]
> 
> Transfer- and Content-Encoding are indeed separate things. One does
> not imply the other. Apache is doing Transfer-Encoding, not
> Content-Encoding, so setting the latter header would be an error.
> 
> The chunking is likely there so that apache can send the file as it is
> being compressed, rather than wait to compress the entire file before
> sending.
> 
> I'm not sure why MSIE isn't caching the file, but I think both the
> Content-Encoding and the chunking are not the problem. You need to
> look elsewhere.
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Problem with mod_deflate and IE6 javascript caching

Posted by Joshua Slive <jo...@slive.ca>.
2008/2/25 Yuan HOng <ho...@gmail.com>:
> Hi, list,
>
>  I have a large javascript file which I want to send to IE6 gziped and
>  for IE6 to cache.
>
>  I set the following derective in the configuration file:
>
>  AddOutputFilterByType DEFLATE application/x-javascript
>
>  The result is but that IE6 doesn't cache the javascript.
>
>  Looking into the response headers, I found that apache is sending
>  Transfer-Encoding: chunked together with Vary: Accept-Encoding, but
>  without Content-Encoding: gzip
>
>  I think that the missing Content-Encoding: gzip might have to do with
>  IE6 not caching the Javascript. Does anybody have an idea about this?
>
>  By the way, I have read that Content-Encoding and Transfer-Encoding
>  are separate things, so I am expecting Apache to send
>  Transfer-Encoding together with Content-Encoding. Why is
>  Content-Encoding dropped?
>
>  Also, the 'chunked' transfer encoding is supposed to be used for
>  dynamically generated content. But my javascript file is a static one.
>  When does apache decide to use 'chunked' encoding? Can I force Apache
>  not to use 'chunked' encoding for gziped content?

[Warning: these are mostly informed guesses. I'm not a gzip expert.]

Transfer- and Content-Encoding are indeed separate things. One does
not imply the other. Apache is doing Transfer-Encoding, not
Content-Encoding, so setting the latter header would be an error.

The chunking is likely there so that apache can send the file as it is
being compressed, rather than wait to compress the entire file before
sending.

I'm not sure why MSIE isn't caching the file, but I think both the
Content-Encoding and the chunking are not the problem. You need to
look elsewhere.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org