My FrontEnd Vue
var config = {
method: 'get',
url: baseUrl + '/v5/test',
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": Token,
},
};
My htaccess file
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule . – [e=HTTP_AUTHORIZATION:%1] SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
Header always set Access-Control-Allow-Origin ""
Header always set Access-Control-Allow-Methods ""
Header always set Access-Control-Allow-Headers: "Authorization"
Header always set Access-Control-Request-Headers: "Authorization"
i’m getting that error
Access to XMLHttpRequest at ‘mydomain.com/v5/test’ from origin ‘app.mydomain.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.
My app is subdomain and API are in domain
2
Answers
Hi guys I fixed doing couple changes
first I add this one in my vue.config.js if you want to build and deploy you just need to uncomment first one to server and second one to local environment
Second In your server I add the htaccess this one:
Thats it the CORS was fixed
This is the headers that I am using for CORS
I don’t know exactly what you are trying to achieve with that .htaccess