I've configured apache 2.4
to compress content before it is delivered to the client, using mod_deflate
and the clients header set to "Accept-Encoding: gzip"
. So this I got already working, producing a valid gzipped file:
curl --header "Accept-Encoding: gzip" https://my.website/ > content.gz
Is there a way to allow "Accept-Encoding: zip"
to compress as zip
?
As far as I understand the documentation this seems not possible:
The gzip encoding is the only one supported to ensure complete compatibility with old browser implementations. The deflate encoding is not supported ... (https://httpd.apache.org/docs/2.4/mod/mod_deflate.html)
Question comes from a Windows
user who cannot unzip gzip
files (I guess using only Windows native tools).
[edit: as gerald-schneider noted a browser will automatically decompress the content - but we are using curl
and such command line tools to be able to script the API and thus there is no browser involved.
Thanks also all the other answers and comments, I think I should have be more precise , i.e. writing down the curl
command to begin with].
I think you misunderstood what the compression in the HTTP protocol is for. It is not for downloading archives. It is to reduce the data that is transferred when you are just browsing. The files that are compressed by it are HTML, CSS, JavaScripts and images. The decompression is handled by the browser before it displays the pages. And the browsers can handle gzip just fine on Windows.
As pointed out in the question's citation of the apache documentation it is not possible to configure apache to serve content compressed as
zip
with themod_deflate
and client's header set toAccept-Encoding: zip
. Onlygzip
works. If a user uses a browser that browser will decode it on the fly. If the user downloads the content with e.g.curl
she has to gunzip thegzip
ed content, be it with OS native tools or installed ones (the latter necessary for e.g. Windows users).Reading your comment, I am a bit unsure of what you are asking:
Anyway, I am not sure the content-encoding is what you are looking for here...