Welcome Guest, Not a member yet? Register   Sign In
CI 4.5.1 CSRF - The action you requested is not allowed.

(This post was last modified: 04-23-2024, 10:35 PM by jackvaughn03.)

Hello experts,

Has anyone encountered the same issue as mine after updating from CI4.4.5 to CI4.5.1? 
Submitting a form with CSRF configuration previously posed no problem.
However, now I can't submit the form using ajax unless I configure it as expected in the filter. 
I need some routes to not be excepted in the filter (csrf->except->[]) configuration.

Thank you in advance.

[Image: Screenshot-2024-04-24-130236.png]

Hey there,

Yes, CI 4.5.1 tightened CSRF handling. To exclude routes, use csrf_exclude() in your controller:

$this->protectExcept(['route1', 'route2']);

This allows AJAX form submissions without CSRF validation on those routes.

@BhambriRohunu Excuese me, are you a bot? Your comment is nonsense.

Theme © iAndrew 2016 - Forum software by © MyBB