请求的资源ListenHTTP处理器上不存在“ Access-Control-Allow-Origin”标头

时间:2019-11-04 15:22:46

标签: apache-nifi

我有一个Nifi集群,其流程从listenHTTP处理器开始。基本上,流接收带有JSON有效负载的POST调用。与邮递员请求或curl调用配合使用时效果很好。但是,当请求来自Web浏览器时,OPTION请求失败,并显示以下错误:

Access to fetch at 'https://{server_endpoint}/process' from 
origin 'https://{client_endpoint}:3443' has been blocked by CORS 
policy: Response to preflight request doesn't pass access control 
check: No 'Access-Control-Allow-Origin' header is present on the 
requested resource. If an opaque response serves your needs, 
set the request's mode to 'no-cors' to fetch the resource 
with CORS disabled.

我们应该如何在ListenHTTP处理器中配置cors。

1 个答案:

答案 0 :(得分:0)

ListenHTTP不支持CORS。您唯一的选择是使用代理服务器,该代理服务器会将浏览器请求发送到NiFi集群。