Make sure you send the Cache-Control $http_cache_control header
in your requests to WP Engine.
If this isn’t configured you will be permanently logged into /wp-admin
and it will not auto logout.
That can be a serious security concern.
Make sure you pass the X-Forwarded-For
headers to WP Engine so that we see the actual IPs and not the proxy IP.
If this isn’t in place, you will get blocked by WP Engine’s firewall.
Gutenberg requires the Rest API so if you are using it, you will also need to proxy a header with a browser request to keep Gutenberg functioning.
Add the following code into the wp-config.php
file only on the first environment.
Make sure to update example.com with the new live domain.
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
$_SERVER['HTTP_HOST'] = 'example.com';
}
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
Reach out to WP Engine Support to add the following NGINX rule into the Nginx configuration for this particular website.
Replace 0.0.0.0/0
with the actual IP range of the proxy provider.
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
Add the following code into the site’s wp-config.php
file for the second environment, making sure to update the domain.com
and domain.com/blog
details to your domain and subdirectory.
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
$_SERVER['HTTP_HOST'] = 'domain.com';
}
define( 'WP_HOME', 'https://domain.com/blog' );
define('WP_SITEURL', 'https://domain.com/blog') ;
Replace 0.0.0.0/0
with the actual IP range of the proxy provider.
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
Finally, run a search and replace on the website to find the WP Engine CNAME (EX: install.wpengine.com
) and replace it with your subdirectory (EX: domain.com/blog
).