It performs the following actions:
- Checks the file is readable or returns "HTTP/1.0 404 Not Found"
- Returns "HTTP/1.1 304 Not Modified" after comparing the HTTP_IF_MODIFIED_SINCE
with the modification date of the static file
- Will try to compress the static file according to HTTP_ACCEPT_ENCODING. Compressed files are store in
the /tmp directory. If compressing extensions are not available, a manually gzip compressed file
can be provided in the /tmp directory. It has to bear the same name with an added .gz extension.
Using manually compressed static files requires you to manually update the compressed file when
the static file is updated.
- Overrides server cache control config to allow caching
- Sends Very Accept-Encoding to tell proxies to store different version of the static file according
to users encoding capacities.
Warning:
Compressed filed are stored in the /tmp directory.
If this method is used with two files bearing the same name but located in different locations,
there is a risk of conflict. One file could be served with the content of the other.
A future upgrade of this method would be to recreate the directory structure of the static file
within a /tmp/compressed-static-files directory.