Welcome! Log In Create A New Profile

Advanced

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Iain Barnett
June 06, 2011 09:50AM
Thanks for replying.

On 6 Jun 2011, at 14:14, António P. P. Almeida wrote:

>
> Problably your app is issuing redirects for that request.

I thought that with the /files location that the Ruby app wouldn't be touched once it handed off the download?

>
> You should
> issue the X-Accel-Redirect header with the the download location.
>
> X-Accel-Redirect path/to/download/file
>
> Only then will the Ruby handling of the file will be overriden and the
> download handled by Nginx. Cf. http://wiki.nginx.org/NginxXSendfile
>
> --- appa


The Ruby code issues the path so it looks like a uri:

headers( {'X-Accel-Redirect' => "/files/#{title}",
'Content-Type' => "audio/#{File.extname(title)[1..-1]}",
'Content-Disposition' => "attachment",
'Content-Transfer-Encoding' => 'application/octet-stream',
'Content-Length' => File.size( path_to_file ).to_s,
'Cache-Control' => 'no-cache',
'Content-Description' => 'File Transfer', })


Here's an example of an actual header it sends:

D, [Mon 06-06-2011 1439 #82286] DEBUG -- : to_send_to_nginx: {"X-Accel-Redirect"=>"/files/file.m4a", "Content-Type"=>"audio/m4a", "Content-Disposition"=>"attachment", "Content-Transfer-Encoding"=>"application/octet-stream", "Content-Length"=>"9032392", "Cache-Control"=>"no-cache", "Content-Description"=>"File Transfer"}

so with this:

location /files {
internal;
alias /Users/www/sites/$http_host/assets/files;
}

it should end up with Users/www/sites/fakehost.blob/assets/files/file.m4a ?

It seems to be correct for what I've read in the docs and examples - does it look right to you?

Regards,
Iain


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Iain Barnett June 06, 2011 08:52AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

António P. P. Almeida June 06, 2011 09:18AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Iain Barnett June 06, 2011 09:50AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Maxim Dounin June 06, 2011 10:08AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Iain Barnett June 06, 2011 10:24AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Maxim Dounin June 06, 2011 10:56AM

Re: Help with X-Accel-Redirect and "rewrite or internal redirection cycle" errors

Iain Barnett June 06, 2011 09:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 238
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready