I've got a website that has both dynamically produced (PHP) and static content. Establishing Apache to transparently compress my way through compliance with content settlement is really a trifle.

However, I'm thinking about not blending static content that rarely, when, changes, but rather serving precompressed data within an "asis" manner.

The concept behind this really is to lessen latency and save CPU energy, and simultaneously compress better. Essentially, rather than blending exactly the same data again and again again, I'd like the server to sendfile the contents without touching it, however with proper headers. And, ideally, it might work effortlessly with .html and .html.gz files, using transparent compression in a single situation and none within the other.

There's mod_asis, but this can not provide proper headers (most significantly those affecting cache and proxy operation), which is agnostic of content settlement. Adding a content-encoding for .gz appears to become the best factor, but does nothing, the ยด.html.gz` webpages appear as downloads (maybe this intervenes with a few default typemap?).

It appears the gatling webserver does precisely what I would like in this way, but I'd really prefer remaining with Apache because despite anything you could blame Apache for, it is the one mainstream server that's been working type of ok for several years.

Another workaround is always to serve the static quite happy with another server on the different port or subdomain, but I'd prefer whether it just labored "invisibly", and when the machine wasn't made more complicated than necessary.

It is possible to well-known configuration idiom which makes Apache behave in the manner indicated?