|
|
@@ -96,20 +96,8 @@ public class XssFilter implements GlobalFilter, Ordered
|
|
|
@Override
|
|
|
public HttpHeaders getHeaders()
|
|
|
{
|
|
|
- HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
HttpHeaders headers = super.getHeaders();
|
|
|
- /* // 遍历源HttpHeaders对象并验证每个头
|
|
|
- for (String headerName : headers.keySet()) {
|
|
|
- String headerValue = headers.getFirst(headerName);
|
|
|
- if ( headerName.matches("[a-zA-Z0-9._\\-]+") && headerValue.matches("[a-zA-Z0-9._\\-]+")) {
|
|
|
- httpHeaders.add(headerName, headerValue);
|
|
|
- }
|
|
|
- }*/
|
|
|
- httpHeaders.putAll(headers);
|
|
|
- // 由于修改了请求体的body,导致content-length长度不确定,因此需要删除原先的content-length
|
|
|
- httpHeaders.remove(HttpHeaders.CONTENT_LENGTH);
|
|
|
- httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked");
|
|
|
- return httpHeaders;
|
|
|
+ return headers;
|
|
|
}
|
|
|
|
|
|
};
|