From 99281f8166c7ec319661ec77b94ebff60141e8c1 Mon Sep 17 00:00:00 2001 From: BenjaminNH <1249376374@qq.com> Date: Tue, 5 Aug 2025 12:56:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=A8=E5=9F=9F=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E6=9D=A1IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/benjamin/equipreservebackend/config/CorsConfig.java | 3 ++- src/main/resources/application-template.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/github/benjamin/equipreservebackend/config/CorsConfig.java b/src/main/java/github/benjamin/equipreservebackend/config/CorsConfig.java index 958e7cd..b484ecc 100644 --- a/src/main/java/github/benjamin/equipreservebackend/config/CorsConfig.java +++ b/src/main/java/github/benjamin/equipreservebackend/config/CorsConfig.java @@ -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("*"); diff --git a/src/main/resources/application-template.yaml b/src/main/resources/application-template.yaml index fcf8b48..bb2ed51 100644 --- a/src/main/resources/application-template.yaml +++ b/src/main/resources/application-template.yaml @@ -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: