Running OSSN behind proxy / port forwarder

Dom Robinson Posted in Technical Support 5 years ago

For a number of reasons I am running OSSN under XAMPP (Apache) on windows. The port is 1080 for the apache server since i also have IIS running: I am trying to get IIS to properly rewrite to the apache server (IIS manages my https certs for a variety of other sites which already successfully reverse proxy using IIS URL Rewrites.)

When i try to connect to the apache server across the lan (http://192.168.0.237:1080/ossn/ all works fine so long as i have "http://192.168.0.237:1080/ossn/ " set as the $Ossn->url in my ossn.config.site.php file.

I have static test file phpinfo.php in the folder and so when i try https://social.mydomain.com/ossn/phpinfo.php i can load that with no problem so my IIS rewrite is working fine too.

However if i update "$Ossn->url" in my ossn.config.site.php to "https://social.mydomain.com/ossn/" (which i think is the correct setting) when i try to connect to https://social.mydomain.com/ossn/ I see 20+ attempts to connect to 'login' which are (correctly) 301 redirected by IIS to apache, but I think apache calls start.php which has an include of ossn.config.site.php, and it tries to add a second layer of redirection which then goes into a loop - so i can't work out how to work properly load OSSN. (If i just leave the Ossn->url blank it also fails.)

One other bit of info: when i change the $Ossn->url back to http://192.168.0.237:1080/ossn/ and then attempt to access it via my IIS redirect the browser URL (unexpectedly) updates to http://192.168.0.237:1080/ossn/ and the browser then connects directly across the LAN as in the initial case above.

It seems the IIS rewrite and OSSN's own rewrite of the host url are fighting with eachother. is there a way to disable the OSSN rewrite cleanly?

Replies
gb Dom Robinson Replied 5 years ago

Awesom Arsalan - tks :)

So

 function ossn_redirect_absolute_url(){
$baseurl    = ossn_site_url();
$parts      = parse_url($baseurl);
$iswww      = preg_match('/www./i', $parts['host']);
$host       = parse_url($_SERVER['HTTP_HOST']);
$redirect   = false;
$port       = "";

Can i just hard code the https://social.mydomain.com/ossn as the value for $baseurl (replacing "ossnsiteurl();" to fix my problem?

Indonesian Arsalan Shah Replied 5 years ago

OSSN redirect to absolute URL (which is required) from non absolute URL, you should see https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/v5.x/libraries/ossn.lib.javascripts.php#L321-L359