Skip to content

Commit

Permalink
Detect HTTPS if wordpress is behind a reverse proxy (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanbes authored and swalkinshaw committed Feb 2, 2019
1 parent e0450b7 commit 785c64f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/application.php
Expand Up @@ -89,6 +89,14 @@
Config::define('SCRIPT_DEBUG', false);
ini_set('display_errors', 0);

/**
* Allow WordPress to detect HTTPS when used behind a reverse proxy or a load balancer
* See https://codex.wordpress.org/Function_Reference/is_ssl#Notes
*/
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}

$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';

if (file_exists($env_config)) {
Expand Down

0 comments on commit 785c64f

Please sign in to comment.