CORS error :Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response

后端 未结 6 1398
礼貌的吻别
礼貌的吻别 2020-12-08 13:18

I am trying to send the request from one localhost port to the another. I am using angularjs on the frontend and node on the backend.

Since it is

6条回答
  •  佛祖请我去吃肉
    2020-12-08 14:10

    If you don't want to install the cors library and instead want to fix your original code, the other step you are missing is that Access-Control-Allow-Origin:* is wrong. When passing Authentication tokens (e.g. JWT) then you must explicitly state every url that is calling your server. You can't use "*" when doing authentication tokens.

提交回复
热议问题