From f1e715ff88ac6beb7dd7ac2316a7bf3526973339 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 6 Jan 2009 10:10:19 +0000 Subject: [PATCH] MDL-9276 reverse proxy and normal access can not be mixed - it would valiate the one address per moodle rule, sorry --- lang/en_utf8/error.php | 1 + lib/setuplib.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index 67f0f0b1c3..2fae06d5a4 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -391,6 +391,7 @@ $string['remotedownloaderror'] = 'Download of component to your server failed, p $string['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that'; $string['reportnotavailable'] = 'This type of report is only available for the site course'; +$string['reverseproxyabused'] = 'Reverse proxy enabled, server can not be accessed directly, sorry.
Please contact server administrator.'; $string['rpcerror'] = 'RPC enrol/mnet/available_courses: ($a)'; $string['scheduledbackupsdisabled'] = 'Scheduled backups have been disabled by the server admin'; $string['sectionnotexist'] = 'This section does not exist'; diff --git a/lib/setuplib.php b/lib/setuplib.php index a13ac17c49..62bb37e585 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -172,6 +172,11 @@ function initialise_fullme() { if (($rurl['host'] != $url['host']) or (!empty($url['port']) and $rurl['port'] != $url['port'])) { print_error('wwwrootmismatch', 'error', '', $CFG->wwwroot); } + } else { + if ($rurl['host'] == $url['host']) { + // hopefully this will stop all those "clever" admins trying to set up moodle with two different addresses in intranet and Internet + print_error('reverseproxyabused', 'error'); + } } $FULLME = $rurl['scheme'].'://'.$url['host']; -- 2.39.5