This feature is documented in standard format here: http://wiki.nginx.org/X-accel
The delivery of a static file which depends on an application header is known as the X-Sendfile feature.
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:
- The header must contain a URI.
- The location should be defined as internal; to prevent the client from going directly to the URI.
Example nginx configuration:
If the application adds an header X-Accel-Redirect for the location
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:
Note that the following HTTP headers aren't modified by nginx:
Content-Type Content-Disposition Accept-Ranges Set-Cookie Cache-Control Expires
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
Links to this issue
proxy_ignore_headers Ignoring Content Type headers when using X-Accel-Redirect
proxy_hide_header Hide headers from upstream servers when using X-Accel-Redirect