diff --git a/lib/setuplib.php b/lib/setuplib.php index 2cdd8f22e1a..7a352781366 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -910,9 +910,16 @@ function initialise_fullme() { $_SERVER['SERVER_PORT'] = 443; // Assume default ssl port for the proxy. } - // Hopefully this will stop all those "clever" admins trying to set up moodle - // with two different addresses in intranet and Internet. - // Port forwarding is still allowed! + // Using Moodle in "reverse proxy" mode, it's expected that the HTTP Host Moodle receives is different + // from the wwwroot configured host. Those URLs beeing identical could be the consequence of various + // issues, including: + // - Intentionally trying to setup moodle with 2 distinct addresses for intranet and Internet: this + // configuration is unsupported and will leads to bigger problems down the road (the proper solution + // for this is adjusting the network routes, and avoid relying on the application for network concerns). + // - Misconfiguration of the reverse proxy that would be forwarding the Host header: while it is + // standard in many cases that the reverse proxy would do that, in our case, the reverse proxy + // must leave the Host header pointing to the internal name of the server. + // Port forwarding is allowed, though. if (!empty($CFG->reverseproxy) && $rurl['host'] === $wwwroot['host'] && (empty($wwwroot['port']) || $rurl['port'] === $wwwroot['port'])) { throw new \moodle_exception('reverseproxyabused', 'error'); }