diff --git a/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/SwaggerConfig.java b/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/SwaggerConfig.java new file mode 100644 index 0000000..2c931ca --- /dev/null +++ b/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/SwaggerConfig.java @@ -0,0 +1,11 @@ +package com.starchive.springapp.global.config; + +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.servers.Server; +import org.springframework.context.annotation.Configuration; + +@Configuration +@OpenAPIDefinition(servers = {@Server(url = "https://starchive-back.store", description = "기본 서버 주소") + , @Server(url = "http://localhost:8080", description = "로컬 주소")}) +public class SwaggerConfig { +} diff --git a/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/WebConfig.java b/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/WebConfig.java index 2023fb8..42eecc5 100644 --- a/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/WebConfig.java +++ b/BACK/spring-app/src/main/java/com/starchive/springapp/global/config/WebConfig.java @@ -1,19 +1,25 @@ package com.starchive.springapp.global.config; +import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +@Slf4j @Configuration public class WebConfig implements WebMvcConfigurer { private static final int ONE_HOUR = 3600; @Override public void addCorsMappings(CorsRegistry registry) { + log.info("Adding CORS mapping"); registry.addMapping("/**") - .allowedOrigins("https://starchive.vercel.app") - .allowedOrigins("https://starchive-back.shop") - .allowedMethods("GET", "POST", "PUT", "DELETE") + .allowedOrigins( + "https://starchive.vercel.app", + "https://starchive-back.store", + "http:localhost:5173" + ) + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // OPTIONS 추가 .allowedHeaders("*") .allowCredentials(true) .maxAge(ONE_HOUR);