I am trying to access a sharepoint server REST api to upload some files. Access is via our tomcat application
Although I believe I setup correctly the headers in IIS the request does not pass the preflight.
Here are the request headers:
Request OPTIONS /_api/contextinfo HTTP/1.1
Accept */*
Origin http://localhost:8080
Access-Control-Request-Method POST
Access-Control-Request-Headers content-type, accept
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; MAAU; rv:11.0) like Gecko
Host temp-sharepoint
Content-Length 0
Connection Keep-Alive
Cache-Control no-cache
and the response headers:
Response HTTP/1.1 401 Unauthorized
Content-Type text/plain; charset=utf-8
Server Microsoft-IIS/7.5
SPRequestGuid 8d690d9d-d06e-101d-6038-8056a7fce7c2
request-id 8d690d9d-d06e-101d-6038-8056a7fce7c2
X-FRAME-OPTIONS SAMEORIGIN
SPRequestDuration 5
SPIisLatency 1
WWW-Authenticate Negotiate
WWW-Authenticate NTLM
X-Powered-By ASP.NET
MicrosoftSharePointTeamServices 15.0.0.4569
X-Content-Type-Options nosniff
X-MS-InvokeApp 1; RequireReadOnly
Access-Control-Allow-Origin *
Access-Control-Allow-Credentials true
Access-Control-Allow-Methods GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers accept,content-type
Date Fri, 05 Jun 2015 15:52:01 GMT
Content-Length 16
My code to request
var url = sharepointURL + "/_api/contextinfo";
jQuery.ajax({
url: url,
type: "POST",
headers:
{
"Accept": "application/json; odata=verbose"
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
contentType: "application/json;odata=verbose",
Why is not passing the preflight? have I misconfigured the headers?