配置跨域访问
1、Nginx配置跨域访问
add_header Access-Control-Allow-Origin *;
2、Tomcat配置跨域访问
Tomcat—conf—web.xml 加入以下代码
参考链接:https://blog.csdn.net/weixin_40070355/article/details/94617247
<filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> <init-param> <param-name>cors.allowed.origins</param-name> <param-value>*</param-value> </init-param> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>