Moodle move to AWS (HTTPS to HTTP) behind ELB

Re: Moodle move to AWS (HTTPS to HTTP) behind ELB

by José Antonio Omedes Capdevila -
Number of replies: 0
Picture of Plugin developers

Hello Steve,

You have two different challenges:

Connections coming through HTTPS to your load balancer:

Those will be forwarded as HTTP to Moodle.

HTTPS ===> (443) Load Balancer (80)  ===> SERVER

1. Install the certificate on yout ELB.

2. Edit the config.php and add the following:

$CFG->sslproxy  = 1;

$CFG->wwwroot   = 'https://<your domain>';


Connections coming through HTTP to your load balancer:

Those will be forwarded as HTTP to Moodle.

HTTPS ===> (40) Load Balancer (80)  ===> SERVER

In this case, we need to find out that the traffic came through HTTP and rewrite URL to https.

1. Edit the virtual host configuration and add the following:

  RewriteEngine On

  RewriteCond %{HTTP:X-Forwarded-Proto} =http

  RewriteRule . https://<your domain> [L,R=permanent]


If not enabled, you will have to enable the Apache rewrite module:

sudo a2enmod rewrite


I hope it helps, 

Jose

jose.omedes@itoptraining.com

www.moodlenet.com



Average of ratings: Useful (3)