1.跨域问题说明:后端域名为A.abc.com,前端域名为B.abc.com. 2.后端设置一个cookie发送给前台,domain应该是setDomain(“abc.com”),而不是setDomain(“B.abc.com”) 3.另外,还要实现WebMvcConfigurerr配置加入Cors的跨域 @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addCor…
ajax跨域访问是一个老问题了,解决方法很多,比较常用的是JSONP方法,JSONP方法是一种非官方方法,而且这种方法只支持GET方式,不如POST方式安全. 即使使用jquery的jsonp方法,type设为POST,也会自动变为GET. 官方问题说明: “script”: Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string…