httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dragon <dra...@crimson-dragon.com>
Subject Re: [users@httpd] How to configure Apache 2 to compress xml files on serving?
Date Fri, 13 Jun 2008 17:45:04 GMT
André Warnier wrote:


>Bo Berglund wrote:
>[...]
>>It seems like there is a setting in the Apache server to change so
>>that the server along with the actual file data also sends "something"
>>that triggers the expansion. What this could be I don't know, and
>>therefore I am asking here.
>If I understand correctly, the files are already 
>compressed on the original server (the file on 
>disk is abc.xml.gz, as opposed to abc.xml), right ?
>
>Then it probably has something to do with the 
>HTTP headers sent in the response.  Apache sends 
>the response to the browser, with a HTTP header like
>Content-type: application/gzip
>or something similar, so that the browser 
>believes that the .gz file is the original 
>content, and proposes to the user to download it as such and save it to disk.
>
>Instead, what you want is that the browser would 
>"believe" that the gzipped file is only a way to 
>transport the original content more efficiently, 
>and that the real content is the xml file, unzipped.
>So you want the response to be sent with HTTP headers like
>Content-type: text/xml
>Content-transport-encoding: gzipped
>
>so that the browser would unpack the zipped file and present the XML document.
>
>I am not quite sure of the exactness of the 
>header names or form above, but it's the 
>idea.  I am unfortunately also not quite sure 
>how to configure Apache to set the headers that 
>way.  It probably requires some module 
>in-between.  I'm sure a neat little mod_perl 
>module would do fine here, but that may not be 
>what you're looking for, and there might be a 
>simpler way using Apache directives only.
---------------- End original message. ---------------------

Perhaps the AddEncoding directive would help? I 
don't really know as I have not tried it, but it is worth a try.

http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addencoding

Combined with the AddType directive to tell the 
system that it is an xml file, it may well do what is needed.

http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype


So something like this (I think):

AddEncoding x-gzip .gz
AddType application/xml .xml.gz


Or maybe the type needs to be text/xml, both are 
valid MIME types for xml documents but I don't 
know which is appropriate to what circumstance.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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