跨域请求阻止React Golang

时间:2019-02-23 11:45:55

标签: reactjs http go axios

我正在尝试通过axios向我的golang微服务发出发帖请求,但出现错误

string="testo(antonio.2018).testo(antonio).testo(giovanni,2018).testo(2018),testo(libero 2019)"

这是我的axios请求

"(antonio.2018)" "(giovanni,2018)" "(libero 2019)"

这是我在golang中的终点站

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:4040/register. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

我认为我缺少了一些东西-有人可以帮我吗

1 个答案:

答案 0 :(得分:0)

您的请求标头似乎缺少CSRF参数。

在MDN页面上阅读它,对我来说,您似乎需要在发送给微服务的请求中传递它。

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

相关问题