Reactjs tomcat apache 8服务器(端口-8080)上的Pentaho API在通过不同的web应用程序(react JS,端口-3000)调用时会出现CORs问题
我不得不调用pentaho API对reactJS应用程序中的用户进行身份验证。两者都在我的本地机器上。到目前为止我已经尝试过的事情: a) 在reactJS配置文件-package.json中添加代理。 问题-代码命中的是localhost:3000,而不是localhost:8080 b) 在没有安全性的情况下启动Google chrome并添加标题。 以上链接2- c) 修改pentaho端的web.xml文件并添加cors jar文件。 问题-我从Maven存储库下载了cors jar文件。添加了相应的过滤器。这些更改后,服务器未启动。 链接- 版本-Pentaho 8.3和tomcat 8 错误-Reactjs tomcat apache 8服务器(端口-8080)上的Pentaho API在通过不同的web应用程序(react JS,端口-3000)调用时会出现CORs问题,reactjs,tomcat,cors,pentaho,pentaho-report-designer,Reactjs,Tomcat,Cors,Pentaho,Pentaho Report Designer,我不得不调用pentaho API对reactJS应用程序中的用户进行身份验证。两者都在我的本地机器上。到目前为止我已经尝试过的事情: a) 在reactJS配置文件-package.json中添加代理。 问题-代码命中的是localhost:3000,而不是localhost:8080 b) 在没有安全性的情况下启动Google chrome并添加标题。 以上链接2- c) 修改pentaho端的web.xml文件并添加cors jar文件。 问题-我从Maven存储库下载了cors jar文
访问位于“”的XMLHttpRequesthttp://localhost:8080/pentaho/j_spring_security_check“起源”http://localhost:3000'已被CORS策略阻止:请求的资源上不存在'Access Control Allow Origin'标头。这终于起作用了。我们需要添加2个jar文件:
CORS
com.thetransactioncompany.cors.CORSFilter
金鸡儿
*
cors.supportsCredentials
假的
cors.supportedHeaders
接受、授权、来源
cors.supportedMethods
获取、发布、头部、选项
科尔斯
/*
重新启动pentaho服务器。它会起作用的
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<!-- Update specific domains instead of giving to all -->
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportsCredentials</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>accept, authorization, origin</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, POST, HEAD, OPTIONS</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>