two addresses to moodle site - intranet & internet - only 1 works :(

two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Number of replies: 10
I have an apache server on my intranet that we have set up a reverse proxy to so that we can get to it from the internet.

Problem is that as it was the intranet address I put into the settings, the links are all wrong when accessing the server from the internet.

I've solved this problem on our email server, which is similarly connected, by redirecting traffic using a php statement to get the remote address of the client [REMOTE_ADDR] - all my intranet addresses being in the private 172.x.x.x and 10.x.x.x ranges.

Is it possible to do something with moodle to do the same, without having to purchase an additional domain name.

Thanks in advance
Mark
Newtown High School
Mid-Wales
評比平均分數: -
In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

Kam Weng Chai發表於

Hi Mark,

For Moodle Site configuration, it use either IP address or domain name to access the site.

Please see this: http://moodle.org/mod/forum/discuss.php?d=27163

Hope this help.

Chai

In reply to Kam Weng Chai

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Thanks for the help Kam.

I have two domain names pointing to my moodle installation - is my problem[!]

My internal address is:
http://newtown-hs.powys.sch.uk/vle
and my external address is:
https://schoolmail.newtown-hs.powys.sch.uk/vle

I've entered the first address into my moodle setup and everything works fine within our WAN. Externally you can get to the root page, but everything that links using the setup parameters doesn't work because the links don't work externally [which you can see if you visit].

I have an intranet of 300 PC's that need to see the site internally, and 1000 potential users that would need to see the site externally. Defining the route in the hosts file I don't think would work, it's not the IP that's the problem - it the single defined domain name in moodles' setup. I was exploring the route of redirects in an .htaccess file but that didn't work.

Thanks again
Mark


In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

Bill Burgos發表於
Hi Mark,

Maybe this discussion might help:

http://moodle.org/mod/forum/discuss.php?d=28040
In reply to Bill Burgos

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Thankyou Bill - that led to the solution!

The example on that post you linked to didn't work for me - I didn't see how Moodle could differentiate between visitors as the first address in the config was always set, no matter where your visitor originated.

I changed the following in the config.php file:

Original:
$CFG->wwwroot   = 'http://newtown-hs.powys.sch.uk/vle';

New:
$internal = FALSE;
if (substr($REMOTE_ADDR,0,3) == "10.") $internal = TRUE;
if (substr($REMOTE_ADDR,0,4) == "172.") $internal = TRUE;
if ($internal) {
$CFG->wwwroot = 'http://newtown-hs.powys.sch.uk/vle';
}
else  {
$CFG->wwwroot = 'https://schoolmail.newtown-hs.powys.sch.uk/vle';
}

Many thanks for everyone's help
Mark
In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Please help [bump]

After making the above modifications I am not able to log in as anyone from the external address: https://schoolmail.newtown-hs.powys.sch.uk/vle/

The site works prfectly otherwise, from both locations, and no error messages are given. The login page just loops.

the internal address works as before, with no problems. All login accounts fully functional.

Thankyou
Mark
In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

Bill Burgos發表於
Hi Mark,

This might have to do with the SSL settings on your installation and not the config.php modification you made. This discussion might help:

http://moodle.org/mod/forum/discuss.php?d=25981


In reply to Bill Burgos

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Thanks again Bill.

I just disabled secure forms - the whole site runs in SSL anyway, and I think that setting was conflicting. Anyway - all working now.

Thanks very much
Mark
In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

Andy Hargreaves發表於
Hi Mark

I have just resolved this problem myself, although my problem was the inverse of yours (the site was not working internally).

The solution is to use the same URL internally and externally.  Change whichever URL (internal or external) is easiest to match the other.  Then, on the local machines, edit the hosts file to include the local address and local IP address of the server.  Mine says:

192.157.0.18    woodle.redirectme.net

Amongst other things, and it works fantastically!

Good luck.

Andy
In reply to Andy Hargreaves

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Thanks Andy

My problem was I am forced to use two URLs!

Regards
Mark
In reply to mark simpson

Re: two addresses to moodle site - intranet & internet - only 1 works :(

mark simpson發表於
Hmmm - another problem - i'm not able to log in from the external address - I keep getting thrown back to the login screen - no errors displayed. Internaly I can log in immediately. I have made sure that cookies are allowed from the site.

Is there something basic i'm missing?

Thanks
Mark