Welcome! Log In Create A New Profile

Advanced

Re: port_in_redirect not working?

Nginx User
November 07, 2011 02:46PM
On 7 November 2011 21:25, olan <nginx-forum@nginx.us> wrote:
> Hi Maxim, thanks for getting back to me.
>
> I've enabled debugging and the output is here:
> http://pastebin.com/Dmw2nJMY. I've cleared all caches and restarted
> varnish, nginx and php5-fpm and mysql.

Line 245 of your debug shows the issue. php is sending a header - http
fastcgi header: "Location: http://XXX.XXX.XXX.XXX:8080/". The
proxy_redirect directive handles this for proxy_pass setups but there
isn't an equivalent for fastcgi.

You can try tricking php by putting $_SERVER["SERVER_PORT"] right at
the top of your index php (or use autoprepend in php.ini so it applies
to all php files).

I just had a problem with this with a proxy setup as the
proxy_redirect only accepts variables in the redirect part such that I
had to do ....

proxy_redirect http://example-1.com:8080/ http://example-1.com/;
proxy_redirect http://example-2.com:8080/ http://example-2.com/;
proxy_redirect http://example-3.com:8080/ http://example-3.com/;
....
proxy_redirect http://example-n.com:8080/ http://example-n.com/;

If the directive accepted variables in the original uri part, a single line ...

proxy_redirect http://$host:8080/ http://$host/;

.... would have done the job and given flexibility. I have to remember
to add every domain I create to the list.

Anyway, I digress. Try the trick on PHP. Nothing can be done in Nginx
until a fastcgi_redirect directive is introduced.

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

port_in_redirect not working?

olan November 07, 2011 09:51AM

Re: port_in_redirect not working?

Maxim Dounin November 07, 2011 12:28PM

Re: port_in_redirect not working?

olan November 07, 2011 01:25PM

Re: port_in_redirect not working?

Nginx User November 07, 2011 02:46PM

Re: port_in_redirect not working?

Nginx User November 07, 2011 02:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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