|
[
Permalink
| « Hide
]
Petr Skoda added a comment - 11/Apr/07 01:48 AM
You can not use two URLs for one Moodle instance, you can find more info here: http://docs.moodle.org/en/masquerading
Petr Skoda made changes - 11/Apr/07 01:48 AM
I have read http://docs.moodle.org/en/masquerading
This article explain that "You can not use internal ip address or internal server name in config.php if you want to access the server from Internet too. If you want to use Moodle server from Internet, use real DNS hostname in $CFG->wwwroot." If you re-read my first post I use real DNS hostname in my config.php $CFG->wwwroot = "http://external_public_name/estudios "; The problem arise when url published in the reverse proxy [ /estudios ] is not the same that the url published in the internal server [ /moodle ] Beyond this error, I think this limitation has no sense. In addition, almost all pages work fine in my configuration, only some errors are displayed in some pages where absolute urls are bad used. I think the errors come from the function me() and/or qualified_me() in weblib.php The main reason why there are absolute urls is that people copy/pase urls from address bar. Decision to use absolute urls was done long ago and I am sure it will not be changed. If you want more info, please search the forums.
We are running moodle on a server at "http://localserver:8088/" and a reverse proxy (pound - http://www.apsis.ch/pound/
Pound handles all calls to "https://example.com/moodle" and directs the traffic to to the local server. We got the same symptoms as described above by Rafael. The module chat wouldn't even load, giving a blank page... We solved the issue (we havn't noticed any side effects yet) by modifing the function qualified_me() in /lib/weblib.php. The function parses the URL from $CFG->wwwroot and uses this information together with information from $_SERVER Replace the function qualified_me() with the one below, and set "$CFG->using_reverseproxy = true" in your config.php. function qualified_me() { global $CFG; $result = $CFG->wwwroot . me(); if( !$CFG->using_reverseproxy ) if (!empty($url['host'])) { $hostname = $url['host']; } else if (!empty($_SERVER['SERVER_NAME'])) { $hostname = $_SERVER['SERVER_NAME']; } else if (!empty($_ENV['SERVER_NAME'])) { $hostname = $_ENV['SERVER_NAME']; } else if (!empty($_SERVER['HTTP_HOST'])) { $hostname = $_SERVER['HTTP_HOST']; } else if (!empty($_ENV['HTTP_HOST'])) { $hostname = $_ENV['HTTP_HOST']; } else { notify('Warning: could not find the name of this server!'); return false; } if (!empty($url['port'])) {
$hostname .= ':'.$url['port'];
} else if (!empty($_SERVER['SERVER_PORT'])) { if (isset($_SERVER['HTTPS'])) { $protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; } else if (isset($_SERVER['SERVER_PORT'])) { # Apache2 does not export $_SERVER['HTTPS'] $protocol = ($_SERVER['SERVER_PORT'] == '443') ? 'https://' : 'http://'; } else { $protocol = 'http://'; } $url_prefix = $protocol.$hostname; return $result; I have the same problem, but there is when i try to modify a profile, the action url in the form point to non existem address
because of qualified_me() end me() functions my solutions was put de same folder name in the moodle application for example: ProxyPass /estudios http://internal_server_name/moodle i change to : ProxyPass /estudios http://internal_server_name/estudios and works, but i think the moodle don't need to have this limitation the problem its the me() function takes varieable from $_SERVER, so the URL http://external_public_name/moodle/any_thing.php if the me() function only returns de script name (any_thing.php), the qualified_me function $result = $CFG->wwwroot .'/'. me(); PS: i'm using moodle 1.8 with this new formslib I've been having what I think is the same problem, but using MS ISA 2006 ;/ as the reverse proxy server.
The solution on that system was to put in a couple of Link Translations in the 'Firewall Policy' area as follows: replace <form action="http://(internal-name)/user/editadvanced.php" method="post" These were the only 2 pages that were causing problems in version 1.8.4 - user profile and blog editing pages. My simplier solution
open weblib.php find me() and replace function me() { with function me() { return str_replace('/somefolder','',notreal_me()); } This renames me() to notreal_me() and then creates a new me() which replaces /somefolder with nothing.. e.g. if your reverse proxy is from xxx.com/ to yyy.com/~xxx then you replace /somefolder with /~xxx You'll need to do this after every update of moodle you do..
Petr Skoda made changes - 31/Dec/08 09:47 PM
Petr Skoda made changes - 06/Jan/09 06:11 AM
Petr Skoda committed 29 files to 'Moodle CVS' - 06/Jan/09 06:37 AM
Reverse proxies are now supported, but the "one address" limitation will not be removed. I can be enabled in config.php - see config-dist.php
I think it could be used probably in some load balancing configurations. thanks for the report, please test and reopen if needed!
Petr Skoda made changes - 06/Jan/09 06:46 AM
Petr Skoda committed 2 files to 'Moodle CVS' - 06/Jan/09 07:10 PM
Mitsuhiro Yoshida committed 3 files to 'Lang CVS' - 07/Jan/09 04:04 PM
martignoni committed 1 file to 'Lang CVS' - 11/Jan/09 05:33 PM
martignoni committed 1 file to 'Lang CVS' - 11/Jan/09 05:39 PM
Hello,
my solution is the next: File: /lib/formslib.php The code must be: function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null) { Not forget that $CFG->wwwroot variable must be configured in config.php Best Regards |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||