首页 文章

发送帖子时阻止跨源请求

提问于
浏览
0

我正在Angular 5中编写应用程序 .

当我尝试发送请求时:

this.httpClient.post("https://api.textlocal.in/send/", new Message(this.apiKey, "xxxxxxxxx", "TEST", "SOIS_App")

我明白了:

阻止跨源请求:同源策略不允许在https://api.textlocal.in/send/上读取远程资源 . (原因:在CORS预检 Channels 的CORS Headers 'Access-Control-Allow-Headers'中遗漏了令牌'access-control-allow-headers') .

当我从计算机发送请求到_1547977时,如何获得CORB?

1 回答

  • 0

    当我从计算机向https://api.textlocal.in发送请求时,如何获得CORB

    在您的服务器上启用地址 localhost (或从您运行应用程序的任何位置)的CORS .

    详细指南

    https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

    快速指南

    • 启用 OPTIONS endpoints

    • 在帖子上启用 Headers :

    Access-Control-Allow-Origin: http://foo.example Access-Control-Allow-Methods: POST Access-Control-Allow-Headers: Content-Type

相关问题