00451: https access converts into http unwillingly

Summary: https access converts into http unwillingly
Created: 2005-06-10 18:18
Status: Closed - not a bug
Category: Bug
From: fbob?
Priority: 2
Version: pmwiki-2.0.beta37
OS: Gentoo Linux/Apache 2.0.54-r4/PHP 4.3.11

Description: https urls are converted into http plaintext urls (within the frames?). This is bad if you want to stay in https. :)

How it was discovered: https access hanged on standard port 443 while receiving part of the html output. I did not have port 80 open for a web service. http access works fine on non-standard ports.

Problem: hrefs in generated source point incorrectly to assumed URL and port assignment (we want https)

Generated source is: "http://mysite.net/pmwiki/pmwiki.php?n=Main.SearchWiki" instead of: "https://mysite.net/pmwiki/pmwiki.php?n=Main.SearchWiki"

If webserver is not available to listen on port 80, it (the continued html frame?) hangs.

Repeatable: every time

Fix: Edited pmwiki.php "http://" reference to "https://" This makes https permanent, but you may want to make it more modular.

The correct "fix" is to set the values of $ScriptUrl and $PubDirUrl in local/config.php to use https:// instead of http:// . No changes to pmwiki.php are required.



Edit the config file, adding this to the end. Replace example.com url with your url.

if($_SERVER['SERVER_PORT']!=80){$prot = 'https';}else{$prot = 'http';}
$ScriptUrl = $prot.'://example.com/wiki/pmwiki.php';
$PubDirUrl = $prot.'://example.com/wiki/pub';

We already have a core variable $UrlScheme that is either 'https' or 'http' depending on the current URL scheme, but unless it is a wiki on the local network, it is recommended to just use 'https'. If it is a local mirror of an online wiki, the $ScriptUrl and $PubDirUrl can be set conditionally depending on different values in $_SERVER like $_SERVER['SERVER_NAME']. --Petko