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
6 changes: 5 additions & 1 deletion src/main/java/savepay/savepay/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ public WebSecurityCustomizer webSecurityCustomizer() {
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
// 개발용: 프론트 주소
config.setAllowedOrigins(List.of("http://localhost:5173"));
config.setAllowedOrigins(List.of(
"http://localhost:5173",
"https://savepay.site", // 배포 백엔드 주소
"https://www.savepay.site" // 배포 서브도메인
));
// 배포시: config.setAllowedOrigins(List.of("https://app.example.com"));
config.setAllowedMethods(List.of("GET","POST","PUT","DELETE","PATCH","OPTIONS"));
config.setAllowedHeaders(List.of("*"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -16,6 +17,8 @@ public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.addServersItem(new Server().url("https://savepay.site"))
.addServersItem(new Server().url("https://www.savepay.site"))
.components(new Components()
.addSecuritySchemes(BEARER_KEY,
new SecurityScheme()
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/savepay/savepay/global/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package savepay.savepay.global;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import savepay.savepay.global.security.resolver.UserInjectionArgumentResolver;
Expand All @@ -14,4 +16,9 @@ public class WebConfig implements WebMvcConfigurer {
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(new UserInjectionArgumentResolver());
}

@Bean
public ForwardedHeaderFilter forwardedHeaderFilter() {
return new ForwardedHeaderFilter();
}
}