You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bo Berglund <bo...@telia.com> on 2008/06/14 08:28:57 UTC

[users@httpd] Re: How to configure Apache 2 to compress xml files on serving?

On Fri, 13 Jun 2008 23:53:13 +0100, Nick Kew <ni...@webthing.com>
wrote:

>On Fri, 13 Jun 2008 19:17:32 +0200
>Bo Berglund <bo...@telia.com> wrote:
>
>> I need to set up a test environment where I am running Apache locally
>> with a number of xml data files as objects to serve.
>> I am doing this to simulate a live server tha I don't want to disturb
>> for my testing. The live server responds to requests for file URL:s
>> like: http://server/dir/file.xml.gz by sending a gzipped data stream
>> that FireFox discovers is compressed and expands it into the browse
>> window so that the file.xml contents is shown.
>
>The above is hopelessly at odds with your configuration:
Well, I only use Apache to test stuff, I have no idea how it works and
the entries in httpd.conf are copies of other entries that seem to
work. That's basically why I ask...

>
>> <Directory "C:/Engineering/Projects/XMLTV/Testsite">
>>     Options Indexes MultiViews Includes
>>     AllowOverride None
>>     Order allow,deny
>>     Allow from all
>>     AddType text/html .shtml
>>     AddType application/x-httpd-php .php
>
>That's been wrong since 1996.  Use AddHandler.

How do I specifically use "AddHandler"?
Do you have a working example?

>
>>     AddOutputFilter INCLUDES .shtml 
>
>That won't work on a compressed file unless you decompress
>it (with mod_deflate) first.

I never said that would work for gz files, it is a *copy* of the
settings I use for another test site where SSI is used and shtml files
are the majority of the files...
Again, I don't know how Apache works, I just copied the settings from
one directory to enable a test site from another directory.

I tried to find some info on AddOutputFilter but the docs only state
that one can use these to process the data before they are sent to the
client (which is what I want) but I could not find any *list* of valid
filters...
Here
(http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addoutputfilter) I
found this:
<quote>
For example, the following configuration will process all .shtml files
for server-side includes and will then compress the output using
mod_deflate.

AddOutputFilter INCLUDES;DEFLATE shtml
</quote>

If I wanted to "filter" xml files so they are compressed using gzip,
how should the filter then be set up???

>
>Neither will any of the above do anything to a file.xml.gz.
>
>If you don't already have them, you probably want
>	AddType text/xml .xml
>(or other XML type)
>	AddEncoding gzip .gz
>
>> </Directory>

After reading some other posts I have this in my conf (still not
working though):

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


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