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: