Skip to content

Commit 481d66d

Browse files
committed
feat: cors 설정 추가
1 parent 22005c6 commit 481d66d

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

backend/src/main/java/com/back/global/config/SecurityConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.springframework.beans.factory.annotation.Value;
44
import org.springframework.context.annotation.Bean;
55
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.http.HttpMethod;
67
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
78
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
89
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -34,6 +35,7 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
3435

3536
.cors(cors -> cors.configurationSource(corsConfigurationSource()))
3637
.authorizeHttpRequests(auth -> auth
38+
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
3739
.requestMatchers("/favicon.ico").permitAll()
3840
.requestMatchers("/h2-console/**").permitAll() // H2 콘솔 접근 허용
3941
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll() // Swagger 접근 허용

backend/src/main/resources/application-prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ custom:
4545
- POST
4646
- PUT
4747
- DELETE
48+
- OPTIONS
4849
allowed-headers:
4950
- "*"
5051

backend/src/main/resources/application.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ custom:
5151
- POST
5252
- PUT
5353
- DELETE
54+
- OPTIONS
5455
allowed-headers:
5556
- "*"
5657

0 commit comments

Comments
 (0)