Select Page

When some websites are updated to make use of Google Cloud Armor, they begin showing a “Too Many Redirects” error instead of the web page. This problem can quickly be resolved by returning the A record for the domain back to the original value (104.154.100.138). Applying the fix mentioned below before updating your A record will avoid seeing the “Too Many Redirects” error completely.

We have traced the issue to a configuration that WordPress uses to ensure that web traffic to your site is secure when it is installed on an ordinary server. However, because we make use of a proxy, the security feature makes a redundant check and is creating additional redirects to try to keep itself safe which leads to the error.

We have a plan to apply this fix to all of the websites but it will take a few days to get it done. If you would like to make use of Google Cloud Armor sooner, you can apply the same fix to your website by following the instructions below. If you are uncomfortable making the changes, we will be doing an email campaign notifying everybody when the fix has been applied for everybody.

Instructions

  1. Connect to your WordPress site using sftp
  2. Download wp-config.php. Take a backup of wp-config.php before editing. The file in general looks like

<?php
/**
 * The base configuration for WordPress
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php 
 *
 * @package WordPress
 */
// WordPress Database Table prefix
//
$table_prefix  = 'wp_';

// Absolute path to the WordPress directory.
//
if ( !defined( 'ABSPATH' ) )
    define( 'ABSPATH', dirname(__FILE__) . '/' );

// Sets up WordPress vars and included files.
//
require_once( ABSPATH . 'wp-settings.php' );
  1. Insert the following code snippet above require_once( ABSPATH . 'wp-settings.php' );
// Make PHP HTTPS aware with HTTP_X_FORWARDED_PROTO
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
     $_SERVER['HTTPS']='on'; 
}
  1. Save and upload the wp-config.php file using sftp.
  2. Flush the cache from the dashboard
  3. Update the A record in your custom domain from 104.154.100.138 to 34.149.86.124

Example wp-config.php

?php
/**
 * The base configuration for WordPress
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php 
 *
 * @package WordPress
 */
// WordPress Database Table prefix
//
$table_prefix  = 'wp_';

// Absolute path to the WordPress directory.
//
if ( !defined( 'ABSPATH' ) )
    define( 'ABSPATH', dirname(__FILE__) . '/' );


// Make PHP HTTPS aware with HTTP_X_FORWARDED_PROTO
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
     $_SERVER['HTTPS']='on'; 
}


// Sets up WordPress vars and included files.
//
require_once( ABSPATH . 'wp-settings.php' );