SITUATION:
company.com
internal domain (different sub domains because they are accessed via SharePoint.company.com
and internalWeb.company.com
)PROBLEM:
http://SharePoint.company.com.
Origin http://internalWeb.company.com
is not allowed by Access-Control-Allow-Origin. WHAT I WANT:
NOTE:
CODE: (on my web page running on internalWeb.company.com
)
$("#details").load("SharePoint.company.com/someDetails.html");
Thanks!
This error occurs when a script on your website/web app attempts to make a request to a resource that isn't configured to accept requests coming from code that doesn't come from the same (sub)domain, thus violating the Same-Origin policy.
Re: CORS issue after ajax post requestYour server needs to not only allow POSTs from the origin using Access-Control-Allow-Origin (origin = your Marketo LP domain including protocol, like https://pages.example.com), it also needs to allow the Content-Type header using Access-Control-Allow-Headers.
If the server is under your control, add the origin of the requesting site to the set of domains permitted access by adding it to the Access-Control-Allow-Origin header's value. You can also configure a site to allow any site to access it by using the * wildcard. You should only use this for public APIs.
A quick fix could be to set a custom header in your SharePoint web.config:
http://www.iis.net/configreference/system.webserver/httpprotocol/customheaders
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
Or for just that domain, try
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://internalWeb.company.com" />
</customHeaders>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With