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

后端 未结 9 2659
借酒劲吻你
借酒劲吻你 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:37

    (Edit) The previously recomended add-on is not available any longer, you may try this other one


    For development purposes in Chrome, installing this add on will get rid of that specific error:

    Access to XMLHttpRequest at 'http://192.168.1.42:8080/sockjs-node/info?t=1546163388687' 
    from origin 'http://localhost:8080' has been blocked by CORS policy: The value of the 
    'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' 
    when the request's credentials mode is 'include'. The credentials mode of requests 
    initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
    

    After installing, make sure you add your url pattern to the Intercepted URLs by clicking on the AddOn's (CORS, green or red) icon and filling the appropriate textbox. An example URL pattern to add here that will work with http://localhost:8080 would be: *://*

提交回复
热议问题