From 8e0dd26b4c3debcec3c8af7b6e3261a802379f11 Mon Sep 17 00:00:00 2001 From: yechan-kim <60172300+yechan-kim@users.noreply.github.com> Date: Wed, 31 Jul 2024 04:12:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20CORS=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/config/SecurityConfig.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/leets/commitatobe/global/config/SecurityConfig.java b/src/main/java/com/leets/commitatobe/global/config/SecurityConfig.java index e5c5b82..02ef2bb 100644 --- a/src/main/java/com/leets/commitatobe/global/config/SecurityConfig.java +++ b/src/main/java/com/leets/commitatobe/global/config/SecurityConfig.java @@ -42,15 +42,15 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { ) .csrf(AbstractHttpConfigurer::disable) .formLogin((formLogin) -> formLogin - .loginPage("/login/github")) + .loginPage("/login/github")) .authorizeHttpRequests((authorize) -> authorize - .requestMatchers("/", "/v3/api-docs/**", "/swagger-ui/**", - "/login/**", "/auth/**", "/h2-console/**", "/error/**").permitAll() - .anyRequest().authenticated() + .requestMatchers("/", "/v3/api-docs/**", "/swagger-ui/**", + "/login/**", "/auth/**", "/h2-console/**", "/error/**").permitAll() + .anyRequest().authenticated() ) .headers(headers -> headers - .frameOptions(frameOptions -> frameOptions.disable()) // H2 콘솔 프레임 옵션 설정 + .frameOptions(frameOptions -> frameOptions.disable()) // H2 콘솔 프레임 옵션 설정 ) .addFilterBefore(new JwtAuthenticationFilter(jwtProvider), UsernamePasswordAuthenticationFilter.class); return http.build(); @@ -59,7 +59,13 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { @Bean CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(Arrays.asList("http://localhost:8080", "http://localhost:3000", "http://localhost:5173", DOMAIN_URI)); + configuration.setAllowedOrigins(Arrays.asList( + "http://localhost:8080", + "http://localhost:3000", + "http://localhost:5173", + "https://api.github.com", + "https://github.com", + DOMAIN_URI)); configuration.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")); configuration.setAllowCredentials(true); configuration.setAllowedHeaders(List.of("*")); From edbb5cbd38d6686d08444a5889460bb81c35f270 Mon Sep 17 00:00:00 2001 From: yechan-kim <60172300+yechan-kim@users.noreply.github.com> Date: Wed, 31 Jul 2024 04:22:24 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=B0=B0=ED=8F=AC=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=EA=B0=80=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appspec.yml | 2 +- scripts/after-deploy.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/appspec.yml b/appspec.yml index f87b2c6..1cc4ff3 100644 --- a/appspec.yml +++ b/appspec.yml @@ -12,4 +12,4 @@ hooks: AfterInstall: - location: scripts/after-deploy.sh timeout: 60 - runas: ubuntu \ No newline at end of file + runas: root diff --git a/scripts/after-deploy.sh b/scripts/after-deploy.sh index 40a8c4c..beaa4bb 100755 --- a/scripts/after-deploy.sh +++ b/scripts/after-deploy.sh @@ -18,7 +18,5 @@ else sleep 5 fi -source ~/.bashrc - echo "> Deploy - $JAR_PATH " -nohup java -jar $JAR_PATH > commitato.log 2>&1 & \ No newline at end of file +nohup java -jar $JAR_PATH > commitato.log 2>&1 &