Commit 97834835 authored by 赵啸非's avatar 赵啸非

修改网关跨域

parent 6915ec9b
......@@ -68,8 +68,8 @@ public class WebLogAspect {
String startTime = map.getOrDefault("startTime", String.valueOf(System.currentTimeMillis()));
long takeTime = (System.currentTimeMillis() - Long.parseLong(startTime));
log.info(" \n 请求路径:{} \n 耗时:{}ms \n 请求报文:{} \n 响应报文:{}"
, request.getRequestURI(), takeTime, map.getOrDefault("req", ""), result == null ? "" : result.toString());
log.info(" \n 请求路径:{} 耗时:{}ms \n 请求报文:{} \n 响应报文:{}"
, request.getRequestURI(), takeTime, map.getOrDefault("req", ""), result == null ? "" : JSON.toJSONString(result));
}
}
......
......@@ -15,7 +15,7 @@ import org.springframework.context.annotation.Configuration;
* @author: zxfei
* @date: 2022/6/17 15:18
*/
@Configuration
//@Configuration
public class AuthFilter {
/**
......
......@@ -16,7 +16,7 @@ import java.util.regex.Pattern;
* @author: zxfei
* @date: 2022/6/20 16:49
*/
@Component
//@Component
public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUrlFilter.Config> {
@Override
public GatewayFilter apply(Config config) {
......
......@@ -32,7 +32,7 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.G
* @date: 2022/6/20 17:00
*/
@Slf4j
@Component
//@Component
public class GlobalLogFilter implements GlobalFilter, Ordered {
@Autowired
......
......@@ -16,6 +16,14 @@ spring:
cloud:
# 网关配置
gateway:
globalcors:
cors-configurations:
'[/**]':
allowedOrigins: "*"
allowedHeaders: "*"
allowedMethods: "*"
default-filters:
- DedupeResponseHeader=Vary Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_FIRST
httpclient:
connect-timeout: 1000
response-timeout: 5s
......
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