fix(gateway): 优化cors配置,网关统一处理

This commit is contained in:
v-zhangjc9
2025-05-30 10:28:16 +08:00
parent 95214f7af3
commit ce95ec7444
4 changed files with 20 additions and 32 deletions

View File

@@ -1,24 +0,0 @@
package com.lanyuanxiaoyao.service.web.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* web 配置
*
* @author lanyuanxiaoyao
* @date 2023-04-21
*/
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
// 避免跨域影响调试
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowCredentials(true)
.allowedMethods("*")
.maxAge(3600);
}
}