CodeIgniter Forums
Chrome/Firefox et al Routing problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Chrome/Firefox et al Routing problem (/showthread.php?tid=82154)



Chrome/Firefox et al Routing problem - jcvasquez07 - 06-17-2022

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?


RE: Chrome/Firefox et al Routing problem - kenjis - 06-17-2022

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/CodeIgniter4/incoming/routing.html#auto-routing-improved



RE: Chrome/Firefox et al Routing problem - jcvasquez07 - 06-21-2022

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.


RE: Chrome/Firefox et al Routing problem - Gary - 06-23-2022

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.php?tid=82015&pid=397607#pid397607