Commit 0a2d681b by wnb0128

跨域问题处理--think.wang

1 parent f786fa4d
......@@ -34,8 +34,11 @@ public class CorsFilter implements Filter {
while (headerNames.hasMoreElements()) {
buffer.append(headerNames.nextElement()).append(",");
}
response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS,
buffer.toString().replaceAll(", *$", ""));
String header = buffer.toString().replaceAll(", *$", "");
if(!(header.contains("Authorization") || header.contains("authorization"))){
header += ",authorization";
}
response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, header);
response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "*");
response.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "18000L");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!