Welcome! Log In Create A New Profile

Advanced

Re: X-accel-redirect serving html download page instead of file.

Maxim Dounin
September 03, 2012 02:32PM
Hello!

On Mon, Aug 27, 2012 at 09:29:47PM -0400, wideawake wrote:

> I have a script that uses x-accel-redirect on a nginx server to send large
> files (150mb+). The script serves downloads fine as long as their is a space
> in the name of the directory but not when the directory is a single word.
> Anyone know why it would be doing so when the file exists and the path is
> correct?
>
> Layout: /Dir/file.exe /Dir2/file.exe /Another Dir/file.exe
>
> If it's /Another Dir/file.exe it serves the file perfectly, however if its
> /Dir/file.exe it serves the html of the download page. Anyone seen this
> before?

I would suggest that the reason is that rewrites which are
commented out in the config you've posted:

> #rewrite ^.*/([-\w\.]+)/([-\w\.]+)\.zip$
> /download.php?model=$1&file=$2.zip last;
> #rewrite ^.*/([-\w\.]+)/([-\w\.]+)\.exe$
> /download.php?model=$1&file=$2.exe last;
> #rewrite ^.*/([-\w\.]+)/([-\w\.]+)\.nbh$
> /download.php?model=$1&file=$2.nbh last;
> #rewrite ^.*/([-\w\.]+)/([-\w\.]+)\.rar$
> /download.php?model=$1&file=$2.rar last;

aren't really commented out. And any X-Accel-Redirect results in
rewrite match, and a download.php output being returned instead.
Obvious solution would be to actually comment them out (or, if
they are needed, to place them into a location which doesn't match
URIs returned in X-Accel-Redirect).

(Files/directories with space work as regular expressions above
doesn't match them.)

Maxim Dounin

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

X-accel-redirect serving html download page instead of file.

wideawake August 27, 2012 09:29PM

Re: X-accel-redirect serving html download page instead of file.

Justin Dorfman August 27, 2012 09:58PM

Re: X-accel-redirect serving html download page instead of file.

wideawake August 27, 2012 10:05PM

Re: X-accel-redirect serving html download page instead of file.

Justin Dorfman August 27, 2012 10:32PM

Re: X-accel-redirect serving html download page instead of file.

wideawake August 27, 2012 11:02PM

Re: X-accel-redirect serving html download page instead of file.

Maxim Dounin September 03, 2012 02:32PM

Re: X-accel-redirect serving html download page instead of file.

poulphunter December 04, 2012 09:07AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
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