Hi All, I new forum user, and ZF!!
I creating a class to force a controller (Module) use https,
PHP Code:
<?php
require_once 'Zend/Controller/Action.php';
class DefaultSSLAction extends Zend_Controller_Action {
function init()
{
//Zend_Debug::dump($_SERVER);
$request = $this->getRequest();
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$module = ($module=='default') ? '': '/'.$module;
$path = $module .'/'.$controller.'/'.$action;
//Force ssl
if( empty($_SERVER["HTTPS"])) {
$host = !empty($_SERVER["HTTP_X_FORWARDED_HOST"]) ? $_SERVER["HTTP_X_FORWARDED_HOST"] : $_SERVER["HTTP_HOST"];
$redir = 'https://'.$host .$path;
$this->_redirect($redir);
}
}
}
TO Gurus: Is this the best way?
Thanxx
BTW:
Apache server, same directory to http & https