Menu

#1 a little tweaking on the SSL support

open
nobody
None
5
2005-04-12
2005-04-12
No

Hi!

I had some trouble getting webuserprefs-0.6 to behave well with 'usessl' set to 'yes', at least with my need for auth/imap.php. After some massaging, it's all going well. My changes:

* sa/index.php: Remove the usessl check from here.
* sa/config.php: Instead, move the usessl definition to the top,
then do the usessl check, and only then include the auth stuff.
Fix it to just do "($GLOBALS["SERVER_PORT"]!=443)" since all
others trying to use the HTTPS variable were failing for me; this
was discussed in a post at
http://www.faqts.com/knowledge_base/view.phtml/aid/11246

So the top of config.php now looks like

// Configuration Section

// Force SSL?
// If you want to require the connection be SSL, set this to yes

$usessl = "yes";
//$usessl = "no";

// If $usesssl is enabled, then check if the request is made with
// HTTPS, SSL, on, and if not, redirect to the HTTPS server.

if($usessl == 'yes' && ($GLOBALS["SERVER_PORT"]!=443)){
//header("Location: https://$sitename$sitepath/index.php");
header("Location: https://$_SERVER[SERVER_NAME]$_SERVER[REDIRECT_URL]");
exit;
}

// Authorization
...

And index.php now just has

include("config.php");

// Include functions
include_once("functions.php");

at the top. I've tested this with 'usessl' being each 'yes' and 'no', so it doesn't change the behavior for the non-SSL approach.

Hope this helps,
B -- brendan@zen.org

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.