【发布时间】:2015-01-02 21:02:19
【问题描述】:
我通过 nginx 服务器打开一个 html 文件,然后 html 文件将“POST”请求从 dropzone 传递到 nginx 服务器,然后 proxy_pass 到我的 go 服务器。然后这个 go 服务器接受请求。
但是当我尝试使用我的 html 文件并在 dropzone 中放置一些东西时,我得到了错误:
XMLHttpRequest cannot load http://localhost:9090/receive. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9009' is therefore not allowed access.
请帮帮我。
【问题讨论】:
-
只需在您的服务器中添加
Access-Control-Allow-Origin标头。 -
这个链接可能对enable-cors.org/server_nginx.html有帮助
-
我无法理解为什么它会显示 CORS 问题,因为我使用的是同一台服务器“localhost”