Welcome! Log In Create A New Profile

Advanced

Re: A question about "proxy_redirect"

July 19, 2011 02:12AM
On Tue, Jul 19, 2011 at 01:35:17AM -0400, speedfirst wrote:
> If the backend server uses FULL URL to initiate a redirect, like
>
> sendRedirect("http://10.1.2.3:1234/redirect");
>
> Can proxy_redirect match this URL and do the redirect?
>
> I write this in config but it seems doesn't work:
>
> proxy_redirect http://10.1.2.3.4:1234/redirect
> http://$host:$server_port;
>
> but nginx still return "Location: http://10.1.2.3.4:1234/redirect" to
> me.
>
> My questions are:
> 1. Does proxy_redirect only work in the case of relative URI
> redirection?
> 2. How should I do if I want to convert the backend server's host in the
> FULL URL redirection case?

nginx uses prefix for redirect. For example, if backend sends
Location: http://10.1.2.3:1234/redirect/to/somewhere
and nginx has directive
proxy_redirect http://10.1.2.3.4:1234/redirect /r;
So nginx will rewrite it as
Location: http://nginx.server.name/r/to/somewhere;


--
Igor Sysoev

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

A question about "proxy_redirect"

speedfirst July 19, 2011 01:35AM

Re: A question about "proxy_redirect"

speedfirst July 19, 2011 01:48AM

Re: A question about "proxy_redirect"

Igor Sysoev July 19, 2011 02:12AM

Re: A question about "proxy_redirect"

Igor Sysoev July 19, 2011 02:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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