Project

General

Profile

Actions

Feature #611

closed

Serve precompressed contents

Added by Anonymous almost 19 years ago. Updated about 1 year ago.

Status:
Fixed
Priority:
Normal
Category:
mod_compress
Target version:
-
ASK QUESTIONS IN Forums:
No

Description

I'm looking for a way to serve precompressed contents. To put it simply, instead of having a regular .html page (http://example.org/test.html) I'd like to compress it as a gzip file and save it as .html.gz. Then, if one requests http://example.org/test.html.gz the corresponding file is sent, along with a "Content-encoding: gzip" header (like Apache would if the "AddEncoding gzip .gz" directive was used).

Another feature would be to decompress the file on-the-fly if the user does not accept gzip as an encoding.

I do understand that mod_compress does a similar job with a small penalty (which is mitigated by caching the output) but storing the files in a precompressed would be more efficient both in terms of storage requirements AND processing (no need to maintain the cache, and the cached version is always available so we never compress the same file twice in its lifetime).

It would be great if lighty could do that. Thanks in advance,

-HR

-- hubert.roksor

Actions #1

Updated by Anonymous over 18 years ago

in your

#add to modules mod_setenv

server.modules = ( "*mod_setenv*" )

#add to mimetype .gz

mimetype.assign = (
".gz" => "'''text/html'''",
)

#add adicional header

$HTTPurl =~ "\.gz$" {
setenv.add-response-header = ( "Content-Encoding" => "x-gzip" )
}

Actions #2

Updated by Anonymous over 16 years ago

I´m using lighttpd 1.4.19 and I had problems using the above solution:

When I had mod_compress enabled, then it seemed that the ".gz" files got gzipped twice. So the browser just showed me garbage. When I disalbed mod_compress, everything was fine.

In the end I found a way to use mod_compress:


$HTTP[url] =~ "\.gz$" {
    setenv.add-response-header = ( "Content-Encoding" => "x-gzip" )
    compress.filetype = ()
    mimetype.assign = ("" => "text/plain")
} 

The addition compress.filetype line did the job!

-- weini

Actions #3

Updated by stbuehler over 16 years ago

  • Status changed from New to Fixed
  • Resolution set to wontfix

Use mod_magnet or mod_fastcgi to do more complex things...

Actions #4

Updated by stbuehler over 16 years ago

  • Status changed from Fixed to Wontfix
Actions #5

Updated by gstrauss about 1 year ago

  • Description updated (diff)
  • Status changed from Wontfix to Fixed
  • ASK QUESTIONS IN Forums set to No

Use mod_magnet with content-negotiation.lua

(Aside: mod_compress has been replaced with mod_deflate, which subsumes and extends the functionality of mod_compress)

Actions

Also available in: Atom