Forums | Mahara Community

Support /
Mahara behind reverse proxy with ssl offload


Sebastian Mery's profile picture
Posts: 2

01 July 2018, 21:17

Hi there,

 

this is my first post to this forum so please be patient with me.

Currently I try to install Mahara next to Moodle on a virtual machine in a DMZ but I am not successful at all.

Moodle is working fine but Mahara refuses to cooperate. The problem is that the reverse proxy (haproxy) is accessed by https, the communication with the mahara server is  done by http. This means that the access of Mahara for the client is using h t t p s : / / but the server needs to serve http.

 

If I set wwroot in the config.php to h t t p : / / the site opens but a lot of files are missing (css, js, ...). If I switch to h t t p s : / / I am not able to open the site at all (Too many redirects).

 

I tried to follow the different manuals and threads but to no avail.

Moodle has a config key sslproxy which handles the link generation.

 

What can I do to get this up and running?

 

Kind regards

 

Sebastian

Robert Lyon's profile picture
Posts: 776

03 July 2018, 12:55

Hi Sebastian,

Currently Mahara does not have a proxy check like Moodle does in the link generation.

I see in Moodle it has this:<

    if (!empty($CFG->sslproxy)) {
        // Return only https links when using SSL proxy.
        return preg_replace('/^http:/', 'https:', $FULLME, 1);
    }

We should be able to add something similar to Mahara as we have the ability to set a proxy address, see:
http://manual.mahara.org/en/18.04/administration/config_site.html#proxy-settings

And on https://git.mahara.org/mahara/mahara/blob/master/htdocs/lib/web.php#L1220

Instead of having:

 return $this->_get_path($filename, $all, $plugindirectory, get_config('wwwroot'));

we could have:

    $url = $this->_get_path($filename, $all, $plugindirectory, get_config('wwwroot'));
        if (get_config('proxyaddress')) {
            $url = preg_replace('/^http:/', 'https:', $url, 1);
        }
        return $url;

Though I suspect that may only work for some of the included things as not all links are generated by that function. Have a go at seeing if this potential change helps and let me know

Cheers,
Robert

Sebastian Mery's profile picture
Posts: 2

06 July 2018, 0:08

Hi Robert,

 

thank you for the suggestions. I changed the file and find that the site loads (at least) but there are still some things missing. I found another location to be changed in the same file at "function smarty" (variable $wwwroot). I was not able to call the modified routine (probably because it is no function but a method).

Because one of the missing things is jsquery I am quite sure that this prevents other parts of mahara to work but it is a good start.

 

Any further hints?

 

Kind regards

 

Sebastian

3 results