Welcome! Log In Create A New Profile

Advanced

catch 302 location in variable

Posted by gerardHoltz 
catch 302 location in variable
July 13, 2015 10:12AM
Hello,

I'm newbe in nginx server. I look for a solution on the web(I'm not a serial poster)... so sorry If this question is common...

> What I try to do
I'm trying to set the same wordpress on 3 differents subdomain, with 3 nginx server block on my configuration.
let say www.mydomaine.com, aaa.mydomaine.com & bbb.mydomaine.com
I want to keep the siteUrl defined in wordpress database set to www.mydomaine.com
I also need to work with fast CGI

> What I managed to do
Everything si set ok. using fastcgi_param & sub_filter, all the front and the backOffice work like a charme.

> What I failled to do
I get some trouble with admin connexion. As in wordpress wp-login.php works with 302 redirection when It succed or it failed, I need to catch 302 redirection sent by my php server, analyse them (regex or whatever), and rewrite them.

let say php server send a 302 error to location "www.mydomaine.com/wp-admin/" (because ww.mydomaine.com is the value set in database...).
I need to redirect it to "aaa.mydomaine.com/wp-admin/" in aaa's "server{}" block and "aaa.mydomaine.com/wp-admin/" in bbb' other "server{}" block.
unfortunaltly, the 302 location can change (depending on login succed or failed), so I can't use a
(...)
fastcgi_intercept_errors on;
error 302=302 aaa.mydomaine.com/wp-admin/
(...)

> ... and my question
is there any way to catch in a variable the 302 location returned by my php server ??? if yes, let say $302_location_from_php, is it possible to configure my nginx with something like

error_page 302 =200 aaa.mydomaine.com/$302_location_from_php;

Any help would help, thanks

Thomas
Re: catch 302 location in variable
July 13, 2015 10:24AM
Oh... any modification in wordpress code cannot be the trick ;o(
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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