Access to XMLHttpRequest has been blocked by CORS policy

后端 未结 7 1736
-上瘾入骨i
-上瘾入骨i 2021-02-18 16:58

I\'ve a problem when I try to do PATCH request in an angular 7 web application. In my backend I have:

app.use((re         


        
7条回答
  •  醉话见心
    2021-02-18 17:11

    I ran into the same issue some time ago. Below piece of code worked for me at the backend. The backend was written in express, node.

    app.use(function (request, response, next) {
      response.header("Access-Control-Allow-Origin", "*");
      response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
      next();
    });
    

提交回复
热议问题