httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Berglund <bo.bergl...@telia.com>
Subject [users@httpd] Re: How to configure Apache 2 to compress xml files on serving?
Date Sat, 14 Jun 2008 17:02:01 GMT
On Sat, 14 Jun 2008 13:59:38 +0200, André Warnier <aw@ice-sa.com>
wrote:

>
>Add the following directive to the above section :
>  AddEncoding x-gzip .gz
>
>and try again
>
>> 
...
>> 
>> Probably now FireFox does not realize that the data are gzipped
>> anymore and tries to parse the binary compressed stream, which
>> obviously fails...
>
>Yes.  Because the server tells Firefox that the document is "text/xml" 
>and Firefox believes it.  That is the right thing to do for Firefox, 
>according to the corresponding Internet RFC's.
>(Unfortunately, that's not what IE does, but that is a whole separate 
>story, in which I hope we don't have to get).
>
>> Have to re-enable this directive...
>
>No.  Leave this one commented out :
> > AddType application/x-gzip .gz .tgz
>
>But add what I indicated above to your Directory section :
>  AddEncoding x-gzip .gz
>
>Note : I am also "fishing" to find the right settings.
>But you have to do this systematically, without getting lost about what 
>you add/remove, otherwise we will not know anymore.
>The important part is what the server sends as headers with the HTTP 
>response.
>We must get to a situation where it sends :
>Content-Type: text/xml  (or application/xml ?)
>Content-Encoding: gzip  (or x-gzip ?)
>
>So that Firefox knows that is is XML, but that it is gzipped.
>
>---------------------------------------------------------------------
>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
>

I think we/you got it now! :-)

I did this in the httpd.conf:

Commented out this in the genaral sections
# AddType application/x-gzip .gz .tgz

Made the directory look like this:

<Directory "C:/Engineering/Projects/XMLTV/XMLTVTestsite">
    Options Indexes MultiViews Includes
    AllowOverride None
    Order allow,deny
    Allow from all
    AddEncoding x-gzip .gz
    AddType application/xml .xml.gz
    AddType text/xml .xml
</Directory>



And now the headers become this when I access a xml.gz link:

HTTP/1.x 200 OK
Date: Sat, 14 Jun 2008 16:55:40 GMT
Server: Apache/2.0.54 (Win32) PHP/4.4.7
Last-Modified: Thu, 12 Jun 2008 22:18:16 GMT
Etag: "5ac36-159b-89b5a184"
Accept-Ranges: bytes
Content-Length: 5531
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/xml
Content-Encoding: gzip

And FireFox displaye the *contents* of the gz file rather than offer
to save it!
BINGO!

A *really* great THANK YOU! for helpong me out!

Bo Berglund


---------------------------------------------------------------------
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


Mime
View raw message