Skip to content

feat: cors 허용#49

Merged
kon28289 merged 1 commit intodevfrom
feat/cors
Dec 2, 2025
Merged

feat: cors 허용#49
kon28289 merged 1 commit intodevfrom
feat/cors

Conversation

@kon28289
Copy link
Copy Markdown
Contributor

@kon28289 kon28289 commented Dec 2, 2025

🚀 1. 개요

  • cors 허용 도메인을 추가합니다.

📝 2. 주요 변경 사항

📸 3. 스크린샷 (API 테스트 결과)

Summary by CodeRabbit

릴리스 노트

  • 기타 업데이트
    • 서비스 접근 설정이 업데이트되어 안정성이 개선되었습니다. 이제 운영 환경과 개발 환경 모두에서 서비스의 모든 기능을 안정적으로 이용할 수 있습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@kon28289 kon28289 self-assigned this Dec 2, 2025
@kon28289 kon28289 added the enhancement New feature or request label Dec 2, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 2, 2025

Walkthrough

CorsConfig.java의 CORS 허용 원본(origin) 목록이 https://geumpumta.shop과 https://dev.geumpumta.shop을 포함하도록 확장됨. 메서드, 헤더, max-age 및 인증정보 설정은 유지되며, 제어 흐름 및 에러 처리는 영향을 받지 않음.

Changes

응집체 / 파일 변경 요약
CORS 설정 확장
src/main/java/com/gpt/geumpumtabackend/global/config/security/CorsConfig.java
CORS 허용 원본 목록에 geumpumta.shop 및 dev.geumpumta.shop 도메인 추가

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • 단순 CORS 설정 값 추가로 논리적 복잡도 없음
  • 기존 패턴의 일관된 확장

Possibly related PRs

Suggested reviewers

  • Juhye0k

Poem

🐰 허락된 곳이 하나 둘 늘어나고,
geumpumta의 문이 활짝 열리네,
shop과 dev 모두 반갑게 맞이하며,
CORS의 경계는 부드러워지네! 🌐

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive PR 설명이 필수 섹션 구조는 유지하고 있으나, '주요 변경 사항'과 '스크린샷' 섹션이 완성되지 않았습니다. 주요 변경 사항 섹션에서 추가된 도메인(https://geumpumta.shop, https://dev.geumpumta.shop)을 구체적으로 명시하고, 테스트 결과 스크린샷을 추가하여 완성해주세요.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 CORS 도메인 추가라는 주요 변경 사항을 명확하게 요약하고 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/cors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/com/gpt/geumpumtabackend/global/config/security/CorsConfig.java (1)

14-14: CORS 허용 도메인 추가를 확인했습니다.

프로덕션(https://geumpumta.shop)과 개발(https://dev.geumpumta.shop) 도메인이 추가되었습니다. 다만, 도메인을 하드코딩하는 것보다 application.yml 또는 환경 변수를 통해 관리하는 것이 환경별 설정 관리에 더 유리합니다.

예시로, application.yml에서 다음과 같이 설정할 수 있습니다:

cors:
  allowed-origins:
    - http://localhost:8080
    - http://localhost:5173
    - https://appleid.apple.com
    - https://geumpumta.shop
    - https://dev.geumpumta.shop

그리고 코드에서는 다음과 같이 주입받을 수 있습니다:

+import org.springframework.beans.factory.annotation.Value;
+import java.util.Arrays;
+
 @Configuration
 public class CorsConfig {
+    @Value("${cors.allowed-origins}")
+    private String[] allowedOrigins;
+    
-    public static CorsConfigurationSource corsConfigurationSource() {
+    @Bean
+    public CorsConfigurationSource corsConfigurationSource() {
         CorsConfiguration configuration = new CorsConfiguration();
-        configuration.setAllowedOrigins(List.of("http://localhost:8080", "http://localhost:5173", "https://appleid.apple.com", "https://geumpumta.shop", "https://dev.geumpumta.shop"));
+        configuration.setAllowedOrigins(Arrays.asList(allowedOrigins));
         configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE"));
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bddd18a and 785d1f3.

📒 Files selected for processing (1)
  • src/main/java/com/gpt/geumpumtabackend/global/config/security/CorsConfig.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/main/java/com/gpt/geumpumtabackend/global/config/security/CorsConfig.java (1)

12-24: No changes needed—the static method pattern is correctly implemented.

The corsConfigurationSource() method is properly called within the filterChainPermitAll() @bean method in SecurityConfig.java (line 54). The static method approach is valid here because it's an explicit factory method invoked during security configuration setup, not a bean that needs Spring container management.

Likely an incorrect or invalid review comment.

@kon28289 kon28289 requested a review from Juhye0k December 2, 2025 12:37
Copy link
Copy Markdown
Contributor

@Juhye0k Juhye0k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kon28289 kon28289 merged commit 82c51a8 into dev Dec 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants