|
1 | | -package com.jocketdan.tour.config; |
2 | | - |
3 | | - |
4 | | -import java.util.List; |
5 | | -import org.springframework.context.annotation.Bean; |
6 | | -import org.springframework.context.annotation.Configuration; |
7 | | -import org.springframework.web.cors.CorsConfiguration; |
8 | | -import org.springframework.web.cors.CorsConfigurationSource; |
9 | | -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
10 | | - |
11 | | -@Configuration |
12 | | -public class CorsConfig { |
13 | | - |
14 | | - @Bean |
15 | | - public CorsConfigurationSource corsConfigurationSource() { |
16 | | - CorsConfiguration config = new CorsConfiguration(); |
17 | | - config.setAllowedOriginPatterns(List.of("http://localhost:*")); // 개발용 |
18 | | - config.setAllowedMethods(List.of("GET","POST","PUT","PATCH","DELETE","OPTIONS")); |
19 | | - config.setAllowedHeaders(List.of("*")); |
20 | | - config.setExposedHeaders(List.of("Authorization","X-User-Id","X-User-Roles")); |
21 | | - config.setAllowCredentials(true); |
22 | | - config.setMaxAge(3600L); |
23 | | - |
24 | | - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
25 | | - source.registerCorsConfiguration("/**", config); |
26 | | - return source; |
27 | | - } |
28 | | - |
29 | | -} |
| 1 | +//package com.jocketdan.tour.config; |
| 2 | +// |
| 3 | +// |
| 4 | +//import java.util.List; |
| 5 | +//import org.springframework.context.annotation.Bean; |
| 6 | +//import org.springframework.context.annotation.Configuration; |
| 7 | +//import org.springframework.web.cors.CorsConfiguration; |
| 8 | +//import org.springframework.web.cors.CorsConfigurationSource; |
| 9 | +//import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
| 10 | +// |
| 11 | +//@Configuration |
| 12 | +//public class CorsConfig { |
| 13 | +// |
| 14 | +// @Bean |
| 15 | +// public CorsConfigurationSource corsConfigurationSource() { |
| 16 | +// CorsConfiguration config = new CorsConfiguration(); |
| 17 | +// config.setAllowedOriginPatterns(List.of("http://localhost:*")); // 개발용 |
| 18 | +// config.setAllowedMethods(List.of("GET","POST","PUT","PATCH","DELETE","OPTIONS")); |
| 19 | +// config.setAllowedHeaders(List.of("*")); |
| 20 | +// config.setExposedHeaders(List.of("Authorization","X-User-Id","X-User-Roles")); |
| 21 | +// config.setAllowCredentials(true); |
| 22 | +// config.setMaxAge(3600L); |
| 23 | +// |
| 24 | +// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
| 25 | +// source.registerCorsConfiguration("/**", config); |
| 26 | +// return source; |
| 27 | +// } |
| 28 | +// |
| 29 | +//} |
0 commit comments