Created
March 31, 2014 06:03
-
-
Save notomato/9886177 to your computer and use it in GitHub Desktop.
SSL redirection in lithium controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect to SSL if we are not in development mode. | |
* | |
* @param object $request | |
* @param array $params | |
* @param array $options | |
* | |
* @return object | |
*/ | |
public function __invoke($request, $params, array $options = array()) { | |
if ($request->is('ssl') || Environment::is('development')) { | |
return parent::__invoke($request, $params, $options); | |
} | |
return $this->redirect(Router::match($request->url, $request, [ | |
'absolute' => true, 'scheme' => 'https://' | |
])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment