Cakephp actions not found in Wampserver Vhost

Asked

Viewed 281 times

12

I am trying to make my administrator actions SSL-protected, including the login action. However, whenever I try to access one of these actions, I always get error 404. For example, when trying to access the login page Cake redirects to https://cakeprebuild.dev/login, with error 404. The apache access log 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 Wamp setup because this only happens when the project is run as Wampserver Vhost, if I try to run through the 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);
}
  • Hello. Could you post where you load the Authcomponent, the Login Controller and your Routes file? So it will be much easier. I believe it is a permission error in the login controller and it enters Loop.

  • Please avoid long discussions in the comments; your talk was moved to the chat

1 answer

1

I’ve had SSL issues in cakephp, but it was due to the server being set up wrongly

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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.