Welcome! Log In Create A New Profile

Advanced

Re: off-domain redirect using X-Accel-Redirect

Francis Daly
April 14, 2011 03:44AM
On Thu, Apr 14, 2011 at 01:36:56AM -0400, dbanks wrote:

Hi there,

> I'd like for my application to send a 302 redirect (or equivalent) to an
> off-domain location (not my server). X-Accel-Redirect appears to be the
> best way to achieve this, but I don't see any reference to the URI being
> a reference to a different server.

X-Accel-Redirect is for the application to tell nginx to return the
content of a different (local) uri. The value should start with "/".

Nginx is a proxy server, so there are ways to map a local uri to a remote
resource, but that seems to be a side issue here:

if you want your application to send a 302 redirect, just send a 302
redirect. You'll need a valid Location: header too.

> Is something like the following allowed?
>
> X-Accel-Redirect: http://www.google.com;
> or
> X-Accel-Redirect: http://img.pics.com/mypic.gif;

It's allowed, but it doesn't do what you hope it does.

If you look in the debug log, you'll see something like

open() "/usr/local/nginx/htmlhttp://www.google.com;" failed (2: No such file or directory)

Good luck with it,

f
--
Francis Daly francis@daoine.org

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

off-domain redirect using X-Accel-Redirect

dbanks April 14, 2011 01:36AM

Re: off-domain redirect using X-Accel-Redirect

Francis Daly April 14, 2011 03:44AM

Re: off-domain redirect using X-Accel-Redirect

dbanks April 14, 2011 07:35PM

Re: off-domain redirect using X-Accel-Redirect

mike April 14, 2011 08:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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