Merge branch 'MDL-63770-master' of /home/jun/moodles/stable_master/moodle

This commit is contained in:
Jun Pataleta
2021-07-15 16:13:11 +08:00
+5 -4
View File
@@ -897,9 +897,10 @@ 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
if (!empty($CFG->reverseproxy) && $rurl['host'] === $wwwroot['host']) {
// 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!
if (!empty($CFG->reverseproxy) && $rurl['host'] === $wwwroot['host'] && (empty($wwwroot['port']) || $rurl['port'] === $wwwroot['port'])) {
print_error('reverseproxyabused', 'error');
}
@@ -950,7 +951,7 @@ function setup_get_remote_url() {
} else {
$rurl['host'] = null;
}
$rurl['port'] = $_SERVER['SERVER_PORT'];
$rurl['port'] = (int)$_SERVER['SERVER_PORT'];
$rurl['path'] = $_SERVER['SCRIPT_NAME']; // Script path without slash arguments
$rurl['scheme'] = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] === 'off' or $_SERVER['HTTPS'] === 'Off' or $_SERVER['HTTPS'] === 'OFF') ? 'http' : 'https';