please help me configure codeigniter 4 project, i have trouble accessing api created in codeigniter 4 when using a header with authorization,
the error enter image description here
CORS error 404
I'm using CORS & JWT libraries enter image description here
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Authorization, X-API-KEY, Origin,X-Requested-With, Content-Type, Accept, Access-Control-Requested-Method");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PATCH, PUT, DELETE, get, post");
$method = $_SERVER['REQUEST_METHOD'];
if($method == "OPTIONS"){
die();
}
I also try adding this on .htaccess (root/.htaccess and root/public/.htaccess)
RewriteCond %{HTTP:Authorization} ^(.*)
#RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
but when i am not using a authorization from my front-end app the api respond successfuly, but when i am using authenticated api using bearer token it respond cors error.
in the postman my authenticated api works fine but in my vuejs app its not enter image description here
What I have tried:
i tried every solution i heave found in GOOGLE but still have no luck :(