CORS: Cannot use wildcard in Access-Control-Allow-Origin when credentials flag is true

后端 未结 9 2510
借酒劲吻你
借酒劲吻你 2020-11-22 01:54

I have a setup involving

Frontend server (Node.js, domain: localhost:3000) <---> Backend (Django, Ajax, domain: localhost:8000)

Browser <-- webapp <

9条回答
  •  长情又很酷
    2020-11-22 02:44

    If you are using express you can use the cors package to allow CORS like so instead of writing your middleware;

    var express = require('express')
    , cors = require('cors')
    , app = express();
    
    app.use(cors());
    
    app.get(function(req,res){ 
      res.send('hello');
    });
    

提交回复
热议问题