Optimizing the SSI module for better caching support


I’m very interested in the optimization method described in this

However there is a problem, IMHO: there is no support for HTTP caching.

As far as I can see, the SSI module does not process the Cache-Control
header of the resources included via the include command.

This is not possible to do, since the SSI commands are processed in the
body filter, but what about adding the Cache-Control header in the
response trailer?

How many browser support trailers in HTTP responses?

Of course, it is possible to control the Cache-Control header using the
ngx_http_headers_module, so it’s not a big issue.

The Last-Modified header is another interesting challenge.
The SSI filter module can process the Last-Modified header for each of
the included resources and add in the trailer the more recent
Last-Modified, but what about validation?

If one of the included resource returns 304 Not Modified, the SSI filter
module should fetch the the fragment from a cache.

Maybe this can be done by the subrequest system?
As an example, when a subrequest response returns 200 OK, the response
is stored in a “cache” (filesystem or memcache);
when 304 Not Modified is returned, the response is fetched from cache
(it can be just an internal location, using an internal redirect).

Is this possible?

Thanks Manlio P.