-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- react 3000번 포트 - 도메인(프론트) 및 서브도메인(백엔드)
- Loading branch information
amm0124
committed
Nov 12, 2024
1 parent
82f13ae
commit 5e04adb
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package poomasi.domain.auth.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.CorsConfigurationSource; | ||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
|
||
import java.util.Arrays; | ||
|
||
@Configuration | ||
public class CorsConfig { | ||
|
||
@Bean | ||
public CorsConfigurationSource corsConfigurationSource() { | ||
CorsConfiguration config = new CorsConfiguration(); | ||
|
||
// 허용할 origin 목록 설정 | ||
config.setAllowedOrigins(Arrays.asList( | ||
"https://localhost:3000", | ||
"https://poomasi.shop", | ||
"https://*.poomasi.shop" | ||
)); | ||
|
||
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); | ||
config.setAllowedHeaders(Arrays.asList("*")); | ||
config.setAllowCredentials(true); | ||
config.setExposedHeaders(Arrays.asList("Set-Cookie", "Authorization")); | ||
|
||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
source.registerCorsConfiguration("/**", config); // 모든 경로에 대해 적용 | ||
|
||
return source; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters