Welcome! Log In Create A New Profile

Advanced

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

Maxim Dounin
June 06, 2011 10:56AM
Hello!

On Mon, Jun 06, 2011 at 03:23:09PM +0100, Iain Barnett wrote:

>
> On 6 Jun 2011, at 15:07, Maxim Dounin wrote:
>
> > Hello!
> >
> > On Mon, Jun 06, 2011 at 01:50:42PM +0100, Iain Barnett wrote:
> >
> >> I'm trying to use X-Accel-Redirect from a Ruby app to hand over
> >> downloading of a file to Nginx, but it fails and the error in
> >> the logs is:
> >>
> >> 2011/06/03 09:18:16 [error] 20500#0: *37 rewrite or internal redirection cycle while internal redirect to "/files/file.m4a" while reading response header from upstream, client: 10.0.1.23, server: hercules, request: "GET /download/e2a25db11bdbdd783531783eaa16eafdfc86355b/1307089096/file.m4a/ HTTP/1.1", upstream: "http://127.0.0.1:8679/download/e2a25db11bdbdd783531783eaa16eafdfc86355b/1307089096/file.m4a/", host: "fakehost.blob", referrer: "http://fakehost.blob/music/file.m4a"
> >
> > Please note "server: hercules".
> >
> > [...]
> >
> >> server {
> >> listen 80;
> >>
> >> server_name fakehost.blob;
> >
> > This is not the server where request is processed.
>
> Sorry, I made that up :) I didn't want to use the actual
> host/server name so I filled in some fake bits, and the tasks of
> Hercules were on my mind - probably because getting computers to
> do what you want can be like pushing a rock up a hill endlessly
> :-D
>
> I should probably have put server: fakehost.blob. Apologies for
> the confusion.

There are two options:

1. You understand things enough to mangle logs and configs, and
you don't need any help with debugging.

2. You need help with debugging.

Choose any one. Obviously with (1) there are no reasons to post
anything here.

If you do care enough about your actual server names but still
need help with debugging - reproduce the problem in sandbox with
fake names.

> Ah ha! Looking at the original, the server name is from one of
> the other site's being proxied to. Does this mean I should use
> an absolute uri for the X-Accel-Redirect header?

No. The problem is still the same: redirect loop happens not in
the server{} you provided, but in other one.

You haven't provided any info, so just wild guess: you want to
read about proxy_ignore_headers directive. See here:

http://wiki.nginx.org/HttpProxyModule#proxy_ignore_headers

Maxim Dounin

_______________________________________________
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: 195
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