I have to use a proxy_pass because I have a main application on / and I want to run WordPress on another server. This is required because my software has multiple servers (load balancing). So the following situation:
server1.com/ is my app
server2.com/ is my app
server1.com/wordpress proxy_pass to server3/wordpress
server2.com/wordpress proxy_pass to server3/wordpress
This all works, but when I want to login it keeps redirecting me to the login page after logging in.
My config looks like this of nginx:
location /wordpress {
proxy_pass http://server3.nl:80/wordpress/;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
In my wordpress wp-config.php I had to fix the following lines in order to make this work:
define('WP_HOME','https://maindomain/wordpress/');
define('WP_SITEURL','https://maindomain/wordpress/');
define('FORCE_SSL_ADMIN', true);
$_SERVER['HTTPS']='on';
Anyone has any idea on how to fix this redirect?
2
Answers
Try to add one more directive into your config
If not then i would look into proxy_cookie_path directive.
I think issue is with cookie domain
Have this as your configuration: