Warning: Undefined array key “HTTP_X_FORWARDED_PROTO” in ../wp-config.php

The HTTP_X_FORWARDED_PROTO line is incorrect. If you use this code your WordPress site will work correctly with your SSL certificate on your proxy/load balancer. But you’ll get the following error.

Warning: Undefined array key “HTTP_X_FORWARDED_PROTO” in ../wp-config.php

The Fix

The fix is pretty straight forward and all you have to do is check that the index exists and then set it as required. Updated your wp-config.php file to look like this.

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
{ $_SERVER['HTTPS']='on'; }

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

*