Michael Shadle mike503 at
Tue Apr 7 00:48:17 MSD 2009

2009/4/6 Maxim Dounin <mdounin at>:
> Hello!

>> header('Content-Transfer-Encoding: binary');

This is being ignored, according to your statement below, right?

> NOTE: passing Content-Length which doesn't match actual message
> length is really bad idea.  This works now as nginx doesn't use
> persistent connections to backends, but likely break things as
> soon as persistent connections support will be introduced.  And it's
> not needed anyway (nginx will use actual file length instead).

The file length has always been right filesize() has been correct.
Unless nginx is actually calculating itself and I can ignore passing
that (?)

>> header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
>> header('X-Accel-Redirect: /foo/protected/' . basename($file_name));
>> Do I need to change something in this so it works (I'll upgrade to 0.7.50 also)
> X-Accel-Redirect takes the following headers from original
> response:
> Content-Type, Set-Cookie, Content-Disposition, Cache-Control,
> Expires, Accept-Ranges
> If you want to pass something else, you may use something like
> this:
>    location /foo/protected/ {
>        add_header  P3P  $upstream_http_p3p;
>        ...
>    }

well the idea was to decouple the application logic from the webserver
as much as possible :)

More information about the nginx mailing list