15 messages in ru.sysoev.nginxRe: X-Sendfile <=> X-Accel-Redirect h...
FromSent OnAttachments
Aleksandar LazicSep 2, 2006 1:20 am 
Igor SysoevSep 2, 2006 8:34 am 
Alexander LazicSep 2, 2006 10:26 am 
Aleksandar LazicSep 17, 2006 2:12 pm 
Igor SysoevSep 18, 2006 2:06 am 
Aleksandar LazicSep 18, 2006 2:17 am 
Cliff WellsSep 18, 2006 2:34 am 
Aleksandar LazicSep 18, 2006 6:48 am 
Aleksandar LazicSep 18, 2006 1:01 pm 
Igor SysoevSep 19, 2006 12:51 am 
Aleksandar LazicSep 19, 2006 1:06 am 
Cliff WellsSep 19, 2006 1:32 am 
Igor SysoevSep 19, 2006 1:35 am 
Cliff WellsSep 19, 2006 2:30 am 
Igor SysoevSep 19, 2006 3:13 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: X-Sendfile <=> X-Accel-Redirect headerActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Sep 2, 2006 8:34:54 am
List:ru.sysoev.nginx

On Sat, 2 Sep 2006, Aleksandar Lazic wrote:

is behind yours X-Accel-Redirect the same idea as in X-Sendfile?!

http://celebnamer.celebworld.ws/stuff/mod_xsendfile/

--- . . If it encounters the presence of such header it will discard all output and send the file specified by that header instead using Apache internals including all optimizations like caching-headers and sendfile or mmap if configured. . .

---

If so is it possible to add X-Sendfile to 'ngx_http_upstream_headers_in[]' in src/http/ngx_http_upstream.c ;-)

The "X-Accel-Redirect" header line is similar to the "X-Sendfile", but has two differences:

1) in XAR you should set an URI, but not path. The URI must be mapped in nginx configuration to some location. The "internal" directive should be used to protect the location from direct access:

location /protected/ { internal; root /some/path; }

As XAR does internal redirect, the request can be redirected to another proxied or FastCGI server. It is not limited to static files only.

2) Some header lines from original response (with XAR) are inherited by an redirected response:

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 a redirected response.

BTW: I haven't seen a doc for this, have I overseen it?!

It is still undocumented but well-known and used by Russian users.