When accessing Google Compute Engine with wordpress installed via Cloud Load Balancing from a browser, a redirect loop occurs.
Chrome returns ERR_TOO_MANY_REDIRECTS, and when I open the network inspector or Cloud Logging, I see that many 301s are running.
Configuration
- Cloud Load Balancing
- Frontend: HTTP and HTTPS protocol
- Host and path rules: all unmatched (default) -> following Backend
- Backend: Instance group with HTTP protocol that contains just one of the following Google Compute Engines VM instance with HTTP Protocol
- VM instance
- Installed on the VM instance: Apache2 2.4.38 , Google-Fluentd 1.9.3 , MySQL-Client 5.7.36 , MySQL-Server 5.7.36 , PHP 7.4.25 , Stackdriver-Agent 6.1.4 , WP-CLI 2.5.0 , WordPress 5.8.1 , phpMyAdmin 5.0.2 (These were installed by WorkPress(Google Click to Deploy))
What I tried
- Hypothesis that WordPress is issuing redirects due to HTTP (not HTTPS) from the load balancer.
- I added the WordPress plugin SSL Insecure Content Fixer and changed the https detection setting to configure
X-Forwarded-Proto
header.
- I added the WordPress plugin SSL Insecure Content Fixer and changed the https detection setting to configure
Other Information
- The permalink setting of wordpress is https://~ (not http://~).
- If you set the IP address of the Google Compute Engine instance to DNS A record instead of the Cloud Load Balancing IP, you can access the site.
How can I fix the redirect loop and access wordpress with the URL of the Load Balancer IP address?