mercredi 1 mai 2019

CORS Error while uploading file - laravel+angular

I am new to laravel messed up with cors permissions: this is my code in index.php

header('Access-Control-Allow-Origin: *');  
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, x-xsrf-token, Accept, Accept-Encoding, token, secret-key, authorization");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');

Getting this error:

Access to XMLHttpRequest at 'http://amazonaws.com:83/api/file/upload' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire