URL rewriting to domain in front of load balancer

URL rewriting to domain in front of load balancer

by James Yenne -
Number of replies: 1
Hi, I'm using an AWS app load balancer (ALB) on my Moodle site (AWS EC2 instance) and its public access is via a ALB URL, and that works.

Then I change the system to use CloudFront, which has an SSL certificate for my domain. When I hit that URL I get back the pages, but all the Moodle URLs (login, sign up, css, js, etc) on the home page are written with the full URL specified as the ALB URL, not my domain name.

The EC2 instance of Moodle has the config.php:

  $CFG->wwwroot = 'http://my-alb-example.com';

  $CFG->sslproxy = false;

This seems right, so then I need to tell Moodle about my domain SSL URL so that it knows how to write the HTTPS URLs with https://example.com/ and not use the load balancer URL.  Does anyone know how to tell Moodle to write URLs with a specific domain or as a relative URL?  Is there a database setting?  Or is this at the Apache level - I didn't see anything there?

Thanks for any help.
Average of ratings: -
In reply to James Yenne

Re: URL rewriting to domain in front of load balancer

by Legacy SOM -
Solved by redirection rule from 80 to 443 from ALB to EC2. CF was directing traffic to 443 while the ELB only had rules for 80, so they were in a redirection loop
Average of ratings: Useful (2)