我遇到了这个错误:
XMLHttpRequest cannot load https://xyz.com/test/points?domain=test.com&id=100. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ('https://sourcerequest.com') is therefore not allowed access.
即使我设置了这样的标题:
headers['Access-Control-Allow-Origin'] = request.headers["HTTP_ORIGIN"]
headers['Access-Control-Expose-Headers'] = 'ETag'
headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'
headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'
headers['Access-Control-Max-Age'] = '86400'
headers['Access-Control-Allow-Credentials'] = 'true'
任何帮助将不胜感激。提前谢谢。
答案 0 :(得分:0)
headers['Access-Control-Allow-Origin'] = '*'