CORS:当凭据标志为真时,无法在访问控制允许原产地中使用通配符
当凭据标志为真时,无法在访问控制-允许-原产地中使用通配符。
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost:8000/');
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();};$.ajax({
type: "POST",
url: 'http://localhost:8000/blah',
data: {},
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: 'json',
success: successHandler});Access-Control-Allow-Credentials: trueAccess-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept"Access-Control-Allow-Methods: 'GET,PUT,POST,DELETE'Content-Type: application/json Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Cookie: csrftoken=***; sessionid="***"
Access-Control-Allow-Headers: Content-Type,*Access-Control-Allow-Credentials: trueAccess-Control-Allow-Origin: *Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETEContent-Type: application/json
chrome --disable-web-security
django-cors-headers
CORS_ORIGIN_ALLOW_ALL = FalseCORS_ALLOW_CREDENTIALS = TrueCORS_ORIGIN_WHITELIST = ( 'http://localhost:3000' # Here was the problem indeed and it has to be http://localhost:3000, not http://localhost:3000/)
德玛西亚99
不负相思意
回首忆惘然
随时随地看视频慕课网APP