允许跨域读取阻止(CORB)用于具有Cache-Control标头的请求

时间:2019-07-05 12:50:13

标签: jquery http http-headers jetty embedded-jetty

我正在使用嵌入式码头服务器(9.4.19.v20190610)并添加了CROS筛选器:

        FilterHolder holder = new FilterHolder(CrossOriginFilter.class);
        holder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*");
        holder.setInitParameter(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "GET,POST,HEAD,PUT");
        // holder.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "*");
        holder.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM,
                "If-None-Match,Prefer,Content-Type,Accept,Origin,X-Requested-With,Pragma,Refer,User-Agent,Host,Connection,Cache-Control,Accept-Language,Accept-Encoding");
        holder.setName("cross-origin");
        dynamicResourceContext.addFilter(holder, "/*", EnumSet.of(DispatcherType.REQUEST));

我用jquery发出请求。如果添加缓存控制字段,则会在Chrome中显示警告:Cross-Origin Read Blocking (CORB) blocked cross-origin response

我的请求如下:

  $.ajax({url: "https://127.0.0.1:8443/rest/msg", headers:{
    'Cache-Control':'no-store'
  }, success: function(result){
    console.log("done");
  }});

没有'Cache-Control':'no-store',我不会收到警告。必须更改CROS过滤器的哪些参数,以使警告消失?怎么了?

谢谢

0 个答案:

没有答案