Support » Fixing WordPress » HTTPS issue with WordPress behind Application Load Balancer on AWS

  • I am attempting to set up a wordpress site behind an application load balancer on AWS in which the certificate is installed on the ALB itself and not on the backing EC2 host. In effect, I am offloading the HTTPS traffic on the ALB and redirecting HTTPS traffic (443) to HTTP traffic (80) at the host.

    As you can see by visiting https://test.rainwalk.net and http://test.rainwalk.net my wordpress configuration does not like this redirection.

    Can anyone help me debug my config such that HTTPS to HTTP works?

    The reason why I am doing it this way is that AWS offers free certificates through their Certificate Authority that secure their load balancers in a management-free way. I do not want to purchase and manage my own certificate to secure the Apache servers on the EC2 back-ends.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Right now your http port is just not opened, make sure apache listens to port 80 and http vhost is there.

    But other than that you’ll need to make WordPress think he is on https so that it won’t issue redirects.
    One way to do that is to overwrite HTTPS=on and SERVER_PORT=443 server variables in your index.php / wp-config.php file.

    Thread Starter agrikk

    (@agrikk)

    One way to do that is to overwrite HTTPS=on and SERVER_PORT=443 server variables in your index.php / wp-config.php file.

    I took a look at index.php and wp-config.php and the two variables you mentioned are not defined anywhere.

    Can you please be more specific on how I “overwrite” these variables?

    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;

    But.. well it’s better to understand what you are doing here, since it’s a kind of hack forcing most of PHP code think it is serving https request, while de-factro it’s not.

    Thread Starter agrikk

    (@agrikk)

    Thanks for the info.

    Before I put in that hack, I changed my configuration so that I now have a CloudFront distribution answering http://www.rainwalk.net requests and is redirecting HTTP requests to HTTPS. It has the http://www.rainwalk.net cert installed for SSL traffic.

    so it is Cloudfront <-> Load Balancer <-> EC2 instances

    Why am I seeing the current behavior?

    https://www.rainwalk.net

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HTTPS issue with WordPress behind Application Load Balancer on AWS’ is closed to new replies.