CakePHP Actions Not Found in Vhost from Wampserver

12

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);
}
    
asked by anonymous 29.07.2014 / 15:35

1 answer

1

I've had SSL problems in cakephp, but it was because the server is configured wrong

I used this apache configuration for localhost and redirected http to https only in .htacess

for SSL / https configuration in apache.conf

  <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
   </Directory>

for htaccess try

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f    
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
    
25.01.2017 / 15:27