WordPress behind HAProxy
-
Hi there,
I have a containerized WordPress server running multiple sites with Traefik, PHPMyAdmin, MySQL DB, and Redis for the cache.
I use only port 80 without SSL in the backend and everything works behind the Pfsense perfectly.
I use SSL Offloading in the HAProxy on my Pfsense but when I try to reach https://mysite.com/wp-admin the page never loads correctly and I can not send login data as well :(
please see the attached screenshots.
what shall I do on my firewall to make my sites work correctly from the Frontend?
I appreciate any answer :)
Thanks alot. -
@mr-elamin2
Did you create a http to https redirect rule in the frontend? -
@viragomann
Yes, all requests on port 80 will get redirected to port 443.
I have other sites and everything work fine except WordPress.! -
@mr-elamin2
Seems that the CSS cannot be fetched properly.I don't use WP actually behind HAproxy, so I'm not experienced with it.
But you can use the debugging mode in the browser to find out, what's going wrong. -
Hi all,
I have got the solution:
adding the bellow code to the wp-config.php file right after <?php in the file has solved my problem.
<?php
// force SSL
$_SERVER['HTTPS']='on';define('WP_HOME','http://mysite.com');
define('WP_SITEURL','http://mysite.com');Thanks all :)
-
@mr-elamin2 Thanks a lot! Been troubleshooting this issue for more than a day but finnaly got it sort out with your method
-
@mr-elamin2 said in WordPress behind HAProxy:
// force SSL
$_SERVER['HTTPS']='on';define('WP_HOME','http://mysite.com');
define('WP_SITEURL','http://mysite.com');Thank you! This was a lifesaver!