Access-Control-Allow-Origin error for one user

匆匆过客 提交于 2019-12-24 11:36:01

问题


I have a WCF service hosted on the same server as another web app, but on a different port. The web app uses jQuery to perform get/post requests on the WCF service, and after configuring the WCF service to allow cross origin requests it works fine and as expected.

One issue is having an issue where sometimes (not always), the requests don't work and after looking at the Chrome dev console the WCF service is throwing the below:g

XMLHttpRequest cannot load {url}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{origin}' is therefore not allowed access. The response had HTTP status code 403.

I can't replicate this at all, and he's using Google Chrome just like other users are. Could it be his machine?


回答1:


you have to add headers at server side like

Access-Control-Allow-Origin: *

Check this link:https://security.stackexchange.com/questions/43639/why-is-the-access-control-allow-origin-header-necessary



来源:https://stackoverflow.com/questions/32991910/access-control-allow-origin-error-for-one-user

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!