Fix WordPress https error on apache and Nginx reverse proxy
If you have an error below when installing WordPress
Blocked loading mixed active content css
Blocked loading mixed active content js file
Add this code on wp-config.php
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = '443';
define('FORCE_SSL_ADMIN', true);
}
if ( isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
