0

My setup is Bitnami WordPress and Google Cloud Load Balancer. I've encountered a few issues.

To use a load balancer with Bitnami WordPress, I've to use this

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

That allows the VM to be accessible by both IP and domain. The problem is Google is indexing the VM's IP and some plugins are using the VM's IP too.

Neither can I use HTTPS because the SSL is handled by the Load Balancer. That causes mixed content issues on some pages when some plugins are used. Adding X-Forwarded-Proto doesn't work.

The website will break if I use any other configuration other than

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

I wonder if it is because of my configuration error or is the native behaviour of Bitnami WordPress.

FlyingPenguin
  • 231
  • 1
  • 9
  • `X-Forwarded-Proto` is the correct method. Saying it does not work is not a good problem description. Clearly define what you configured and what does not work. – John Hanley Dec 07 '22 at 07:38
  • @JohnHanley Thanks. Saying `X-Forwarded-Proto` does not work mean adding that does not make any changes to the website. In the post, `define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');` is the configuration. – FlyingPenguin Dec 07 '22 at 08:15
  • I do not see that configuration in your question. Also, are you redirecting users from HTTP to HTTPS? There are three areas with WordPress. 1) `x-forwarded-proto`. 2) HTTPS redirection. 3) Correct URLs in the content. – John Hanley Dec 07 '22 at 19:49
  • @JohnHanley It is a default Bitnami WordPress set up. HTTP to HTTPS redirection is handed by load balancer. – FlyingPenguin Dec 08 '22 at 00:14
  • Comments like that are not productive. How did you verify that WordPress is correctly handling HTTP versus HTTPS? – John Hanley Dec 08 '22 at 00:42
  • @JohnHanley I'm not sure which part of the post is not clear. The problem is Bitnami WordPress does not correctly handle HTTP to HTTPS redirection when a load balancer is used. Bitnami WordPress has a different setup than the default WordPress. – FlyingPenguin Dec 08 '22 at 05:54
  • You are responsible for posting the details required to answer or solve your problem. Please read this guide: https://stackoverflow.com/help/how-to-ask – John Hanley Dec 08 '22 at 06:18
  • Thanks @JohnHanley I don't think I have more info to add. Bitnami Wordpress has a different setup than normal WordPress. It is the default configuration of Bitnami WordPress and the main problem is it doesn't recognize Google Load Balancer to handle HTTPS redirection. – FlyingPenguin Dec 08 '22 at 12:56

0 Answers0