feat: 跨域允许配置多条IP
This commit is contained in:
parent
086c5f3f31
commit
99281f8166
@ -7,6 +7,7 @@ import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ -18,7 +19,7 @@ public class CorsConfig {
|
||||
@Bean
|
||||
public CorsConfigurationSource corsConfigurationSource() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowedOriginPatterns(List.of(allowedOrigins));
|
||||
config.setAllowedOriginPatterns(Arrays.asList(allowedOrigins.split(",")));
|
||||
config.setAllowCredentials(true);
|
||||
config.addAllowedHeader("*");
|
||||
config.addAllowedMethod("*");
|
||||
|
@ -16,7 +16,7 @@ jwt:
|
||||
secret: your-secret
|
||||
equip-reserve:
|
||||
device-days: 7
|
||||
allowed-origins: http://localhost:5173
|
||||
allowed-origins: "http://localhost:5173,http://127.0.0.1:5173"
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
|
Loading…
x
Reference in New Issue
Block a user