Project

General

Profile

[UE] mod_deflate and dynamic content

Added by lighttrick 4 months ago

In 'Known Limitations' section of mod_deflate documentation, it says:

'mod_deflate deflate.cache-dir, if set, contains cached output of static files,
but does not cache dynamic responses unless the response contains an ETag
response header.'

As far as I understand from that quote, if a dynamic response, such as a PHP
script (I know it's your favorite language!) has an ETag header then the
compressed content will be cached, right?

I created a simple script like this:

<?php
header("ETag: some-gibberish-here");
echo phpinfo();

Below is my deflate settings:

# lighttpd has write permission, I know because static file caching works
deflate.cache-dir = "/path/to/cache/dir/compressed" 
deflate.mimetypes = ( "application/javascript", "text/css", "text/html", "text/plain" )
deflate.allowed-encodings = ( "gzip", "deflate" )

But mod_deflate does not cache that response according to the documentation.
Actually I don't expect this to work. After all, all PHP requests are sent to
the fpm backend. It's not possible to send the cached compressed content to the client
before mod_fastcgi, right?

Probably, it's something I misunderstand but could you please clarify that
quote?

Thanks in advance.


Replies (3)

RE: mod_deflate and dynamic content - Added by gstrauss 4 months ago

Please read the entire mod_deflate "Known Limitations" section again and focus on the first paragraph and the explicit lighttpd configuration example in that first paragraph.

If the existing documentation does not answer your question, please read
How to get support

RE: mod_deflate and dynamic content - Added by gstrauss 4 months ago

If you want your dynamically generated PHP responses to be compressed, then you should consider doing so in the PHP, which can be more selective about what it choose to compress based on application knowledge of the PHP response.

RE: mod_deflate and dynamic content - Added by gstrauss 4 months ago

server.stream-response-body = 0 (which is the default)

    (1-3/3)