Made a custom restrict access for a client based on Access forbidden | Kirby CMS. It has more features but works on the same base. On my localhost and two servers, it works without issues, but on the client’s server, it goes to redirect loop every time after login.
Browser error is:
The page isn’t redirecting properly. This problem can sometimes be caused by disabling or refusing to accept cookies.
The domain is properly redirected, it redirects to https and www.
Although must mention that before this integration client had htaccess password protection enabled.
In the controller for the login page tried changing this
if ($kirby->user()) {
go('/');
}
to
if ($kirby->user()) {
go('home');
}
but it didn’t help.
I would really appreciate some hint, maybe someone had a similar issue, although I didn’t find it in the forum.
One more thing, redirect error is only on the home page after login. I can go to any other page without problems.
Are there any other .htaccess files in a higher hierarchy folder? Or some domain redirection in the provider panel involved? Or something in the Virtual host config? Hard to tell without knowing the exact configuration. Since it works on your other setups, I’m sure there is some misconfiguration on the client server involved.
Hi, Sonja!
Good questions, that’s the next thing to check for sure. Didn’t have access to the server yet.
But wanted to rule off the cookie as error first.
That code is according to the cookbook, you should only run into an issue if all pages are restricted, i.e. including the home page. But that would then happen no matter which server.
It really looks as if the logged-in user isn’t stored. We see a POST request to login, but then GET requests going backwards and forwards between login and home. So the user is sent to home, but then back again to login and so forth