Cakephp Authcomponent会话在使用SSL unforce方法后过期
-
在注册期间对5个网页使用SSL
Using SSL for 5 pages while during registration
https://www.mysite.com/step3 - Auth组件登录
https://www.mysite.com/step3 - Auth component login
在第3步之后,我使用Auth组件创建一个用户会话(自动使用户通过Auth组件登录)。但在第5步之后它将重定向到以下页面
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
我使用SSL组件未强制的方法更改 HTTPS 更改为 HTTP 。
每一件事情都很好,但问题是一旦我从step5(HTTPS)到达欢迎页面,我的Auth组件会话过期。我试图调试它
找不到任何解决方案。请注意,没有HTTPS,所有步骤和会话都可以正常工作
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
em>
Code in AppController class :
function beforeFilter() {
parent::beforeFilter();
$this->_setupSecurity();}
function _setupSecurity() {
$this->Security->blackHoleCallback = '_badRequest';
if(Configure::read('forceSSL')) {
$this->Security->requireSecure('*'); }
}
/ **
*主SecurityComponent回调。
*处理缺少的SSL问题和一般的错误请求。
* /
/** * 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;}
/ **
*到同一个页面,但使用https协议并退出。
* /
/** * 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..