Welcome Guest, Not a member yet? Register   Sign In
Chrome/Firefox et al Routing problem
#1

Hello all, here's my problem: I'm using CI 4.2.1 and I'm implementing the login procedure on an existing site. Since the default view has to be the login form, I do:

PHP Code:
// file: app\Config\Routes.php
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);
$routes->get('/''Usuarios::login');   // prevents auto-routing 

This works correctly in Chrome but when I open the site using Firefox, Edge or Opera I hit a 404 error:

Quote:404 - File Not Found
Cannot access the controller in Defined Routes. Controller: \App\Controllers\Usuarios

However, the controller IS at app\Controllers\Usuarios.php and it works fine when listing/adding/deleting/editing users.

Any thoughts?
Reply
#2

If you use Auto Routing Improved, you can't access controllers in your Defined Routes via auto routing.


Quote:For security reasons, if a controller is used in the defined routes, Auto Routing (Improved) does not route to the controller.
https://codeigniter4.github.io/CodeIgnit...g-improved
Reply
#3

Exactly. If I hardcode a route, I expect that autorouting won't route to that controller, so when I defined '/' it should route to 'Users::login', which Chrome does but other browser don't. The point of my question isn´t wether routing is working or not but why it does work in Chrome but not in Firefox.
Reply
#4

(This post was last modified: 06-23-2022, 09:22 AM by Gary.)

Floored by the same problem.

I see there are quite a few folk being blindsided by this improvement. One of just many examples: https://forum.codeigniter.com/showthread...#pid397607
Reply




Theme © iAndrew 2016 - Forum software by © MyBB