spring 跨域

Spring跨域问题

血红的双手。 提交于 2019-12-01 02:31:05
spingMVC 3.X跨域 关于跨域问题,主要用的比较多的是cros跨域。 详细介绍请看 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS 但是,在springmvc+angularjs下支持跨域请求时,出现复杂跨域场景(post + json)失败的情况。 开始的跨域配置如下: public class CrossInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { response.addHeader("Access-Control-Allow-Origin","*"); response.addHeader("Access-Control-Allow-Methods","*"); response.addHeader("Access-Control-Max-Age","100"); response.addHeader("Access-Control-Allow-Headers",