AWS with Moodle

AWS with Moodle

by hakim hairon -
Number of replies: 5

Hi everyone,

really need your help. currently I'm working with AWS services to build moodle. 

the flow is : EC2 (VM installed moodle) -> Application Load Balancer -> Cloudfront (CDN)

i was unable to browse moodle using my domain name that register on cloudfront. it can only browse by using domain name of the ALB.

and another one is, if i browse as https, the css of moodle will not reload. it can only reload on HTTP request.


anyone have counter this problem before ?

Average of ratings: -
In reply to hakim hairon

Re: AWS with Moodle

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The URL that browsers will use to access the site must be set in $CFG->wwwroot in config.php.

If the application load balancer is reverse proxying requests – so that the Moodle server does not see the original host name in the request – then you must add $CFG->reverseproxy = true to config.php.

If the TLS connection terminates before the Moodle server – for example if the certificate and private key are installed on the application load balancer – then you must add $CFG->sslproxy = true to config.php.

Average of ratings: Useful (2)
In reply to Leon Stringer

Re: AWS with Moodle

by hakim hairon -
you suggestion look better but now i got 404 error. is it any additional thing need to be done ?



wwwroot = https://domain.com
httpd document root = /var/www/html/moodle
CDN origin = /alb-dns.com/moodle


In reply to hakim hairon

Re: AWS with Moodle

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The 404 Not Found looks like it comes from the web server (or maybe a device in front of the web server) not Moodle.

Using your browser's developer tools (for example Network Monitor in Firefox) can you see if the 404 is in response to the browser request to the URL that's in $CFG->wwwroot or is there a redirect first (for example 303 See Other)?

Also: ensure any caching for the site is disabled in Cloudfront.

In reply to Leon Stringer

Re: AWS with Moodle

by hakim hairon -
hello leon, right now if im pointing my domain to ALB the HTPPS work well. but if I create cloudfront, and point my domain to cloudfront it shows 303 keep redirect. any idea ?
In reply to hakim hairon

Re: AWS with Moodle

by hakim hairon -
Its work like a charm !! Thank you so much leon. you are the best !

the thing that I left behind is $CFG->reverseproxy = true .  i though that I don't need that since I'm not using nginx but maybe for cloudfront it was needed. anyway thanks for your help. aprreaciate it !