Filter Cors now working |
I have the following cors filter:
PHP Code: ... And in Filter class: PHP Code: ... But not work. It only works if I add the headers into index.php in the public folder. How to resolve this?
You just defined an alias, you're not calling you filter anywhere. That's why it's not working. You need to add the filter to the 'before' or 'after' array of the $globals property. See https://codeigniter.com/user_guide/incom...ml#globals
In you case it would be in the 'before' array, like that: PHP Code: public $globals = [
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Donot us this in a live server!
Access-Control-Allow-Origin: * Use: Access-Control-Allow-Origin: https://yourDomain.com What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |