Reputation: 509
I am using $http.get mthod to hit the mysql services to get the records of particulars table, even post and put is working fine. it fails on get method.
In request header we have like this Provisional headers shown Accept-Language:en-US,en;q=0.8 Access-Control-Request-Headers:accept, authorization Access-Control-Request-Method:GET Host:d.example.com Origin:http://localhost Referer:http://localhost/xxxx/ User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
It shows "Provisional headers shown" error if this error happens it fails the api. can you give some suggestions where it goes wrong , actually i set all the headers in mysql services
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization"); header("Access-Control-Allow-Credentials: true"); header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); header("Accept: text/html,application/json,text/plain");
header("Content-Type: application/json");
Upvotes: 0
Views: 66
Reputation: 509
I found a solutions .... Actually am using two services one for mysql and other for micro service mongoDB
So the problem is passing authentication header for mysql , now i remove the header for mysql service calls and the problem solved.
using below code
$http.defaults.headers.common = {};
Which may help for others.
Upvotes: 0