I'm trying to make my admin actions protected by SSL, including login action. However whenever I try to access one of these actions, I always get the 404 error. For example, when trying to access the login page, Cake redirects to link , with error 404. The access log of apache has for each entry, for these actions, "GET / login HTTP / 1.1" 302 -, in this case for the login action. I'm not sure if the problem is cake or a bad configuration of Wamp because this only happens when the project is run as Vhost of Wampserver, if I try to run through localhost, https://localhost/CakePreBuild/login
, everything works perfectly. How can this problem be solved?
I'm using CakePHP 2.4.4 and Wampserver 2.5 64bit
UsersController
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->deny('index');
if (isset($this->params['admin'])) {
$this->Security->csrfCheck = false;
$this->Security->blackHoleCallback = 'forceSSL';
$this->Security->requireSecure();
}
}
public function forceSSL() {
return $this->redirect('https://' . $_SERVER['SERVER_NAME'] . $this->here);
}