Commit a56f35e5 authored by 王业雄's avatar 王业雄

test

parent 1ff69cf9
package com.quantgroup.asset.distribution.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
......@@ -16,6 +17,7 @@ import java.util.Set;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration
@Slf4j
public class CrosFilter implements Filter {
private static final Set<String> DISALLOWED_METHOD = new HashSet<>();
......@@ -43,9 +45,11 @@ public class CrosFilter implements Filter {
String allowedHeaders = "Origin, No-Cache, x-auth-token, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type,Authorization";
response.setHeader("Access-Control-Allow-Headers", allowedHeaders);
response.setHeader("Access-Control-Max-Age", "3600");
log.info("doFilter | 前端请求过滤,请求方法{}",request.getMethod());
if (DISALLOWED_METHOD.contains(request.getMethod())) {
return;
}
log.info("doFilter | 前端请求过滤,请求方法{}",request.getMethod());
filterChain.doFilter(servletRequest, servletResponse);
}
......
package com.quantgroup.asset.distribution.config.web;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
......@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.config.web.interceptor.AuthorityInterce
*
*/
@Configuration
@Slf4j
public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Autowired
......@@ -30,6 +32,7 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
log.info("addCorsMappings | 前端请求过滤");
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "GET", "POST")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment