Serving manually compressed gzip

F

fireup6

Guest
#1
I manually gzip my index and save it in my html folder as index.gz

Now i can set index.gz as the index of the page, but it will not be displayed in the client's browser because the Content-Encoding header is not set to gzip.

I had a solution to this in apache2 in my apache2.conf
Code:
<Directory /var/www/html>

  #Set index
  DirectoryIndex index.html

  #redirect index.html to index.gz if gzip is supported by client
  RewriteCond %{HTTP:Accept-encoding} gzip
  RewriteRule ^index\.html$ index.gz

  #set Content-Encoding header
  <filesMatch "\.(gz)$">
          Header set Content-Encoding "gzip"
          Header set Cache-Control "max-age=2592000, public"
          AddType text/html .gz
  </FilesMatch>

</Directory>
I've been trying to do this in OLS, but i can't seem to be able to. OLS doesn't seem to support either the <directory> or <filesMatch> tags, and i haven't been able to get it working by creating a context either, although it seems like it should work.

Any suggestions?

Thanks!

EDIT: Just discovered that putting "/\" (without quotes) as your URI for a context will lock you out of being able to edit that context. The buttons will just stop working, so you will be forced to edit the vhconf.conf file manually and change the name.

The following settings work (sort of):
URI: /
Location: $VH_ROOT
Extra Headers: Content-Encoding: gzip
MIME Type: text/html gz
Index: Index.gz

The problem with this is that since the URI is just "/", this rule will be applied to everything, breaking images from loading...etc. I only need "/" to apply to that web root, not the following directories.

EDIT2: Solved. I used "exp:^/$" perl regex in the URL to match the single / , hopefully this doesn't break anything.
 
Last edited by a moderator:
Top