X-Accel-Redirect with filename

Igor Sysoev is at rambler-co.ru
Tue Aug 28 10:01:27 MSD 2007

On Mon, Aug 27, 2007 at 12:25:33PM +0100, Malte Sussdorff wrote:

> I am using an internal content repository which does not use the  
> filenames to store the content but just numbers. So e.g. malte.gif  
> would be 23/34/233401 in the file system.
> My OpenACS application picks this up easily because it knows the  
> mime_type, the file_name and the location from the database.
> My question now is though, would it be possible to have an internal  
> location, which not only accepts the file path, but also the  
> file_name and mime_type and return that correctly to the user? So my  
> webserver could redirect with X-Accel-Redirect to "/files/ 
> 23/34/233401?file_name=malte.gif&mime_type=image/gif" and nginx would  
> deal with correctly returning the file?
> Maybe I am asking too much, but http://blog.kovyrin.net/2006/11/01/ 
> nginx-x-accel-redirect-php-rails/ brings me already half way.
> Alternatively I could always use proxy_store, though I am not sure if  
> it handles fine the fact that I would access a file e.g. /images/ 
> 233401 and my server returns malte.gif, I probably need to test that.

nginx inherits Content-Type and Content-Disposition headers
of X-Accel-Redirect response, i.e.:

X-Accel-Redirect: /files/23/34/233401
Content-Disposition: malte.gif
Content-Type: image/gif

Igor Sysoev

More information about the nginx mailing list