All Projects → evanmiller → Mod_zip

evanmiller / Mod_zip

Licence: bsd-3-clause
Streaming ZIP archiver for nginx 📦

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mod zip

Nginx Module Vts
Nginx virtual host traffic status module
Stars: ✭ 2,518 (+1314.61%)
Mutual labels:  nginx, nginx-module
Nginx Tutorial
最全面,最深入的nginx从入门到精通的教程
Stars: ✭ 416 (+133.71%)
Mutual labels:  nginx, nginx-module
Ngx php
ngx_php - Embedded php scripting language for nginx module. All released versions of the code repository.
Stars: ✭ 290 (+62.92%)
Mutual labels:  nginx, nginx-module
Nginx Http Echo Module
A simple Nginx echo module
Stars: ✭ 192 (+7.87%)
Mutual labels:  nginx, nginx-module
Ngx dynamic limit req module
The ngx_dynamic_limit_req_module module is used to dynamically lock IP and release it periodically.
Stars: ✭ 57 (-67.98%)
Mutual labels:  nginx, nginx-module
Ngx php7
ngx_php7 - Embedded php7 scripting language for nginx module. Mainline development version of the ngx_php.
Stars: ✭ 337 (+89.33%)
Mutual labels:  nginx, nginx-module
Nginx Opentracing
NGINX plugin for OpenTracing
Stars: ✭ 341 (+91.57%)
Mutual labels:  nginx, nginx-module
Testcookie Nginx Module
simple robot mitigation module using cookie based challenge/response technique. Not supported any more.
Stars: ✭ 447 (+151.12%)
Mutual labels:  nginx, nginx-module
Nginx Nonewlines
This is an nginx module to strip the served HTML of all newlines (\n and \r characters)
Stars: ✭ 17 (-90.45%)
Mutual labels:  nginx, nginx-module
Nginx Module Sysguard
Nginx sysguard module
Stars: ✭ 568 (+219.1%)
Mutual labels:  nginx, nginx-module
Nginx Builder
A tool to build deb or rpm package of required Nginx version from the source code, with the ability to connect third-party modules. Nginx parameters are set in the yaml configuration file.
Stars: ✭ 123 (-30.9%)
Mutual labels:  nginx, nginx-module
Zstd Nginx Module
Nginx modules for the Zstandard compression
Stars: ✭ 64 (-64.04%)
Mutual labels:  nginx, nginx-module
Ngx healthcheck module
nginx module for upstream servers health check. support stream and http upstream. 该模块可以为Nginx提供主动式后端服务器健康检查的功能(同时支持四层和七层后端服务器的健康检测)
Stars: ✭ 145 (-18.54%)
Mutual labels:  nginx, nginx-module
Nginx Helper
Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
Stars: ✭ 170 (-4.49%)
Mutual labels:  nginx
Guacamole Install Rhel 7
Apache Guacamole installation bash script for RHEL 7 and CentOS 7 including options for Nginx, HTTPS, SSL, LDAP, Let's Encrypt certificates and more
Stars: ✭ 174 (-2.25%)
Mutual labels:  nginx
Docker Django
A project to get you started with Docker and Django.
Stars: ✭ 170 (-4.49%)
Mutual labels:  nginx
Libzippp
C++ wrapper for libzip
Stars: ✭ 169 (-5.06%)
Mutual labels:  zip
Badssl.com
🔒 Memorable site for testing clients against bad SSL configs.
Stars: ✭ 2,234 (+1155.06%)
Mutual labels:  nginx
Pwnginx
Pwn nginx - a nginx backdoor provides shell access, socks5 tunneling, http password sniffing.
Stars: ✭ 173 (-2.81%)
Mutual labels:  nginx
Bunkerized Nginx
🛡️ Make your web services secure by default !
Stars: ✭ 2,361 (+1226.4%)
Mutual labels:  nginx

mod_zip

Build Status

mod_zip assembles ZIP archives dynamically. It can stream component files from upstream servers with nginx's native proxying code, so that the process never takes up more than a few KB of RAM at a time, even while assembling archives that are (potentially) gigabytes in size.

mod_zip supports a number of "modern" ZIP features, including large files, UTC timestamps, and UTF-8 filenames. It allows clients to resume large downloads using the "Range" and "If-Range" headers, although these feature require the server to know the file checksums (CRC-32's) in advance. See "Usage" for details.

To unzip files on the fly, check out nginx-unzip-module.

Installation

To install, compile nginx with the following option:

--add-module=/path/to/mod_zip
  • nginx 1.10.0 or later is required
  • (optional) to enable the X-Archive-Charset header, libiconv is required
  • http_postpone must be enabled by including at least one of the http_addition, http_slice or http_ssi modules

Usage

The module is activated when the original response (presumably from an upstream) includes the following HTTP header:

X-Archive-Files: zip

It then scans the response body for a list of files. The syntax is a space-separated list of the file checksum (CRC-32), size (in bytes), location (properly URL-encoded), and file name. One file per line. The file location corresponds to a location in your nginx.conf; the file can be on disk, from an upstream, or from another module. The file name can include a directory path, and is what will be extracted from the ZIP file. Example:

1034ab38 428    /foo.txt   My Document1.txt
83e8110b 100339 /bar.txt   My Other Document1.txt

Files are retrieved and encoded in order. If a file cannot be found or the file request returns any sort of error, the download is aborted.

The CRC-32 is optional. Put "-" if you don't know the CRC-32; note that in this case mod_zip will disable support for the Range header.

Re-encoding filenames

To re-encode the filenames as UTF-8, add the following header to the upstream response:

X-Archive-Charset: [original charset name]

The original charset name should be something that iconv understands. (This feature only works if iconv is present.)

If you set original charset as native:

X-Archive-Charset: native;

filenames from the file list are treated as already in the system native charset. Consequently, the ZIP general purpose flag (bit 11) that indicates UTF-8 encoded names will not be set, and archivers will know it's a native charset.

Sometimes there is problem converting UTF-8 names to native(CP866) charset that causes popular archivers to fail to recognize them. And at the same time you want data not to be lost so that smart archivers can use Unicode Path extra field. You can provide you own, adapted representation of filename in native charset along with original UTF-8 name in one string. You just need to add following header:

X-Archive-Name-Sep: [separator];

So your file list should look like:

<CRC-32> <size> <path> <native-filename><separator><utf8-filename>
...

then filename field will contatin native-filename and Unicode Path extra field will contain utf8-filename.

Tips

  1. Add a header "Content-Disposition: attachment; filename=foobar.zip" in the upstream response if you would like the client to name the file "foobar.zip"

  2. To save bandwidth, add a "Last-Modified" header in the upstream response; mod_zip will then honor the "If-Range" header from clients.

  3. To wipe the X-Archive-Files header from the response sent to the client, use the headers_more module: http://wiki.nginx.org/NginxHttpHeadersMoreModule

  4. To improve performance, ensure the backends are not returning gzipped files. You can achieve this with proxy_set_header Accept-Encoding ""; in the location blocks for the component files.

Questions/patches may be directed to Evan Miller, [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].