Code in the AppController class:
function beforeFilter() {
parent::beforeFilter();
$this->_setupSecurity();}
function _setupSecurity() {
$this->Security->blackHoleCallback = '_badRequest';
if(Configure::read('forceSSL')) {
$this->Security->requireSecure('*'); }
}
/ ** * The main SecurityComponent callback. * Handles both missing SSL problems and general bad requests. * /
function _badRequest() {
if(Configure::read('forceSSL') && !$this->RequestHandler->isSSL()) {
$this->_forceSSL();
} else {
$this->cakeError('error400');
}
exit;}
/ ** * Redirect to the same page, but with https protocol and exit. * /
function _forceSSL() {
$this->redirect('https://' . env('SERVER_NAME') . $this->here);
exit;
}
Follow this link: Maybe you will get your solution.
fooobar.com/questions/1124375 / ...