|
4 | 4 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.AUTHORIZATION_HEADER; |
5 | 5 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.CONTENT_TYPE_HEADER; |
6 | 6 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.DELETE_METHOD; |
7 | | -import static com.codecampus.ai.constant.config.SecurityConfigConstant.FRONTEND_ENDPOINT; |
8 | | -import static com.codecampus.ai.constant.config.SecurityConfigConstant.FRONTEND_ENDPOINT2; |
9 | | -import static com.codecampus.ai.constant.config.SecurityConfigConstant.FRONTEND_ENDPOINT3; |
10 | 7 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.GET_METHOD; |
11 | 8 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.OPTIONS_METHOD; |
12 | 9 | import static com.codecampus.ai.constant.config.SecurityConfigConstant.PATCH_METHOD; |
@@ -111,10 +108,12 @@ public CorsConfigurationSource corsConfigurationSource() { |
111 | 108 | CorsConfiguration configuration = new CorsConfiguration(); |
112 | 109 |
|
113 | 110 | // Cho phép các origin truy cập định nghĩa sẵn |
114 | | - configuration.setAllowedOrigins( |
115 | | - List.of(FRONTEND_ENDPOINT, FRONTEND_ENDPOINT2, |
116 | | - FRONTEND_ENDPOINT3) |
117 | | - ); |
| 111 | + configuration.setAllowedOriginPatterns(List.of( |
| 112 | + "http://3.27.221.69:*", // mọi port HTTP của 3.27.221.69 |
| 113 | + "https://3.27.221.69:*", // nếu có HTTPS |
| 114 | + "http://192.168.1.30:4200", |
| 115 | + "http://localhost:4200" |
| 116 | + )); |
118 | 117 |
|
119 | 118 | // Cho phép các phương thức HTTP được định nghĩa |
120 | 119 | configuration.setAllowedMethods( |
|
0 commit comments