Problems with IP address in links and resources

Problems with IP address in links and resources

by Aaron Milligan -
Number of replies: 3

I'm running Moodle on a VM from behind a firewall with a reverse proxy routing the subdomain of my site to the local machine.

On my local network, everything works as it should: moodle.domain.com goes to the moodle site, and all links work. If I load my site from outside of my firewall though, I'm able to get the home page of my moodle site, but all the styles and themes are missing, and when I hover over any link, it's going to http://192.168.10.15/somepage.


Is this something I'm missing in my Moodle setup, or do I not have my reverse proxy set up correctly?

Average of ratings: -
In reply to Aaron Milligan

Re: Problems with IP address in links and resources

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
What are $CFG->wwwroot, $CFG->reverseproxy and $CFG->sslproxy in $moodle/config.php?

Is there (or, was there) a computer with the IP address 192.168.10.15 in your LAN?
In reply to Visvanath Ratnaweera

Re: Problems with IP address in links and resources

by Aaron Milligan -

I started over with a clean installation yesterday.


$CFG->wwwroot = 'http://moodle.domain.com'

$CFG->reverseproxy didn't exist

$CFG->sslproxy also didn't exist.

I inserted $CFG->reverseproxy = 'true', and now I'm able to access my site from outside of my local network, and from the hostname (http://moodle/), but if I try http://moodle.domain.com from my local network, it says "Reverse proxy enabled, server can not be accessed directly, sorry. Please contact server administrator."

In reply to Aaron Milligan

Re: Problems with IP address in links and resources

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

It sounds like that maybe you added the domain name and did not update your database.  I am presuming that your website at one time was just accessed through the ip address?

If you added the domain name later, you need to run the replace.php tool found at "yoursite"/admin/tool/replace/index.php