This is a follow-up issue with my first post. I have successfully deployed my AngularJS web site to Azure and I can get interact with Azure Search using the REST API GET method. Now I am facing the issue with a PUT method. It is complaining that my preflight request does not pass control check. By examining the network traffic, I can see that the browser is doing a OPTIONS request method to Azure Search, and the response code is 404 Not Found.
I noted that someone else had faced this problem , and the work around is to use Standard Pricing Tier. I am already on Standard and problem is still there. My Angular Search CORS is already set to "*". And I have tried to modify my client side AngularJS $http code by adding headers options but still not functional.
Any ideas will be appreciated.
Update #2 to answer @Bruce Johnston, I guess I could not paste too much code as a comment block so I will put them here.
This is a $http.get that is operational:
$http.get("https://mywebsibe/indexes/contact1/docs?api-version=2016-09-01",
{
headers: {
"Accept": "application/json",
"api-key": "xxx"
},
params: {
//api-version: '2016-09-01',
queryType: "full",
search: searchString
}
}
)
This is a PUT that is encountering CORS issue:
$http.put("https://mywebsite/indexes/contact1/docs?api-version=2017-11-11",
{
headers: {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST, GET, OPTIONS, DELETE",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
"Accept": "application/json",
"api-key": "xxx"
},
data: {
"value": [
{
"@search.action": "upload",
"ContactId": "id1",
"FirstName": "New",
"LastName": "Guy",
"Dob": "1990-01-31",
"Gender": "M",
"Email": "ng@somewhere.org"
}
]
}