Welcome Guest, Not a member yet? Register   Sign In
Filters order
#1

(This post was last modified: 02-05-2023, 08:08 AM by ruslan.)

Hi

I have CorsFilter global filter set in Config/Filters and custom AuthFilter set in Config/Routes

PHP Code:
$routes->post('uri''SomeConroller::index', ['filter' => 'authFilter']); 

I need CorsFilter filter to be executed first, but authFilter takes precedence, outputs response and CorsFilter is never called
How can i make sure CorsFilter is always executed first?
Reply
#2

Now route filters are always executed first.
You cannot change the filter order unless you replace the framework core class.
Reply
#3

I sent a PR to change the filter execution order:
https://github.com/codeigniter4/CodeIgniter4/pull/7955
Reply




Theme © iAndrew 2016 - Forum software by © MyBB