Load Balancing Problems

Load Balancing Problems

by Charles Swinburne -
Number of replies: 3

I have three servers, i want to use one for load balancing using HAProxy, and the rest is the client. I have installed the load balancer and the other two servers with moodle 4.1 and it worked perfectly when i access the moodle clients directly from the ip. The problem arises when i try accessing via load balancer. For some reason it shows me an "Too many redirects" error when i pressed "Login" button on the homepage. Is there any workaround for this? I can provide some configuration screenshot if needed. Thanks in advance

Average of ratings: -
In reply to Charles Swinburne

Re: Load Balancing Problems

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

You probably need to add $CFG->reverseproxy = true; to config.php. Depending on the SSL/TLS endpoint you may also need $CFG->sslproxy = true; or some combination of these settings.

In reply to Leon Stringer

Re: Load Balancing Problems

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
...or $CFG->wwwroot setting is wrong in your config.php on each front-end.

$CFG->reverseproxy just skips a "sanity check" for the wwwroot setting so (in my limited experience) you're just going to get an error about the setting be wrong if you don't have it and need it.

I hate setting up reverese-proxies and load-balancers. Trying to keep in your head what is going on is near impossible smile
In reply to Howard Miller

Re: Load Balancing Problems

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

@Howard: Ah, I didn't read the question properly, you're more likely correct.

@Charles: What's $CFG->wwwroot set to? The same value on every web server? It must be for Moodle to work properly. And is it a URL with a domain name? Or an IP address (bad idea)?