我正在通过nginx服务器打开一个html文件,然后该html文件将来自dropzone的“ POST”请求传递给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.
请帮我。
在上面的错误中,您的页面正在从http://localhost:9009
请求加载到http://localhost:9090/
。根据此处的“相同来源”描述,这些是不同的来源:http : //tools.ietf.org/html/rfc6454#section-5
原点必须匹配:
对您而言,方案和主机相同,但端口不同。因此,您将需要添加CORS标头,以允许调用方在上调用您的服务器http://localhost:9090
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句