Using SSL for 5 pages while during registration
https://www.mysite.com/step1
https://www.mysite.com/step2
https://www.mysite.com/step3 - Auth component login
https://www.mysite.com/step4
https://www.mysite.com/step5
After step 3 I am creating a Session of the user using Auth Component ( automatically make the user logged in by Auth component). But after step5 It will redirect to the following page
http://www.mysite.com/welcome
I am using SSL component unforced method to change HTTPS to HTTP .
Every thing working fine but the problem is Once I reached the welcome page from step5(HTTPS) my Auth component session expires. I try to debug it
could not find any solution. Please note that without HTTPS all steps and sessions are working fine
Code in 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 the https protocol and exit.
*/
function _forceSSL() {
$this->redirect('https://' . env('SERVER_NAME') . $this->here);
exit;
}
Follow this link: May be you get your solution..
https://stackoverflow.com/a/4473178/983624
if you are using Cakephp 2.0 then go to the following folder
lib/Cake/Model/Datasource/
Open the CakeSession.php file and search for the following line
if (!isset($sessionConfig['ini']['session.cookie_secure']) && env('HTTPS'))
{
$sessionConfig['ini']['session.cookie_secure'] = 1; // Just comment this line and try it will works
}