Supporting SSL termination with WordPress can require some modifications. This guide will help you to quickly get set up, allowing you to have the Snapt Balancer or Snapt Accelerator offload your SSL requests, and use plain text to your webservers.

Background

Let's assume you terminate the SSL (https) connection at a load balancer or web proxy in front of your webservers. You then have clients connecting to your site on https://blog.snapt.net (for example), but the webserver sees http://blog.snapt.net.

You need to tell your webserver that actually this is a secure connection, but you are terminating it. Otherwise it might think it is not, and redirect the user to https://blog.snapt.net - getting in a loop!

Easy Change to WordPress

To tell webservers and websites about this, load balancers (including Snapt) will use an X-Forwarded-Proto header.

You can tell WordPress to read this by editing your wp-config.php script, and adding the following code above the line that says "/* That's all, stop editing! Happy blogging. */".

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

That will tell your WordPress site to assume it is an HTTPS connection if the X-Forwarded-For header is set to "https".

Snapt users: ensure you are adding that header in the Balancer or Accelerator!