Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Loading