This feature is documented in standard format here: X-Accel

The delivery of a static file which depends on an application header is known as the X-Sendfile feature.

Lighttpd has this feature and there is a mod_xsendfile for Apache2.

NGINX also has this feature, but implemented a little bit differently. In NGINX this feature is called X-Accel-Redirect.

There are two main differences:

  1. The header must contain a URI.
  2. The location should be defined as internal; to prevent the client from going directly to the URI.

Example NGINX configuration:

location /protected/ {
 root   /some/path;

If the application adds an header X-Accel-Redirect for the location /protected/iso.img:

X-Accel-Redirect: /protected/iso.img;

Then NGINX will serve the file /some/path/protected/iso.img - note that the root and internal redirect paths are concatenated.

If you want to deliver /some/path/iso.img then configure NGINX like this:

location /protected/ {
  alias   /some/path/; # note the trailing slash

Note that the following HTTP headers aren’t modified by NGINX:


If some of these header lines are not set, then they will be set by the redirected response.

The application can also have some control over the process, sending the following headers prior to X-Accel-Redirect.

X-Accel-Limit-Rate: 1024
X-Accel-Buffering: yes|no
X-Accel-Charset: utf-8