Skip to content

⚙️ CORS 허용 Origin 추가 #151

Open
KJaeKwan wants to merge 2 commits into
developfrom
chore/150-cors
Open

⚙️ CORS 허용 Origin 추가 #151
KJaeKwan wants to merge 2 commits into
developfrom
chore/150-cors

Conversation

@KJaeKwan
Copy link
Copy Markdown
Contributor

@KJaeKwan KJaeKwan commented Sep 27, 2025

✨ Related Issue


📌 Task Details

  • CORS 허용 Origin만 추가

💬 Review Requirements (Optional)

Summary by CodeRabbit

  • Chores
    • CORS 허용 도메인 범위를 확대하여 withus 관련 Vercel 프리뷰/프로젝트 하위 도메인 접근을 허용했습니다.
    • 다양한 배포 환경에서 브라우저 요청이 차단되는 사례를 줄여 접속 안정성과 테스트 편의성이 향상되었습니다.
    • 기존 로컬 및 기존 도메인 허용 설정은 그대로 유지되며, 기능 동작에는 변화가 없습니다.

@KJaeKwan KJaeKwan self-assigned this Sep 27, 2025
@KJaeKwan KJaeKwan added the ⚙️chore 수정, 빌드, 배포 관련 label Sep 27, 2025
@KJaeKwan KJaeKwan linked an issue Sep 27, 2025 that may be closed by this pull request
1 task
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 27, 2025

Walkthrough

CORS 설정에 allowedOriginPattern 항목이 추가되어 Vercel의 와일드카드 도메인(https://withus-*-chaewons-projects-*.vercel.app)을 허용하도록 확장되었으며, 그 외 메서드·헤더·노출 헤더·기존 로컬호스트 허용은 변경 없음.

Changes

Cohort / File(s) Summary of Changes
CORS 설정 확장
src/main/java/KUSITMS/WITHUS/global/config/CorsConfig.java
allowedOriginPatternhttps://withus-*-chaewons-projects-*.vercel.app 추가. 기존 허용 오리진/메서드/헤더/노출 헤더 및 제어 흐름은 유지.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Poem

깡충, 깡충—헤더 사이 춤을 춘다
새 하늘 열어 준 별표의 문장들 ✨
버셀 바람 타고 오는 요청들아, 어서 와
나는 검은 귀 토끼, CORS 문지기
허락된 길로만, 부드럽게 통과하라 🛤️
오늘도 로그는 고요, 설정은 단단!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed 제목이 CORS 허용 Origin 추가라는 주요 변경 사항을 명확히 요약하고 있으나 이모지가 포함되어 있어 스타일 가이드 관점에서 권장되지 않습니다.
Description Check ✅ Passed PR 설명은 Related Issue, Task Details, 그리고 선택적 Review Requirements 섹션을 모두 포함하며 CORS 허용 Origin 추가 작업을 명확하게 문서화하여 템플릿 구조와 내용 요구 사항을 충족합니다.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/150-cors

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7daedda and 1b80d23.

📒 Files selected for processing (1)
  • src/main/java/KUSITMS/WITHUS/global/config/CorsConfig.java (1 hunks)

for (int port = 3000; port <= 3010; port++) {
config.addAllowedOriginPattern("http://localhost:" + port);
}
config.addAllowedOriginPattern("https://withus-*-chaewons-projects-*.vercel.app");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

와일드카드 패턴이 실제 Vercel 도메인을 매치하지 않습니다.

Vercel 프리뷰 주소 형식은 보통 https://withus-git-브랜치-chaewons-projects.vercel.app처럼 chaewons-projects 뒤에 하이픈(-)이 오지 않습니다. 현재 패턴(chaewons-projects-*.vercel.app)은 하이픈을 강제로 요구하므로 실제 프리뷰 도메인이 모두 CORS에서 거절되는 치명적 문제입니다. 하이픈을 제거하거나 projects 뒤를 자유롭게 허용하는 패턴으로 고쳐 주세요.

다음과 같이 수정하면 의도한 도메인을 정상 허용할 수 있습니다:

-        config.addAllowedOriginPattern("https://withus-*-chaewons-projects-*.vercel.app");
+        config.addAllowedOriginPattern("https://withus-*-chaewons-projects.vercel.app");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
config.addAllowedOriginPattern("https://withus-*-chaewons-projects-*.vercel.app");
++ b/src/main/java/KUSITMS/WITHUS/global/config/CorsConfig.java
@@ Lines 28-28
config.addAllowedOriginPattern("https://withus-*-chaewons-projects.vercel.app");
🤖 Prompt for AI Agents
In src/main/java/KUSITMS/WITHUS/global/config/CorsConfig.java around line 28,
the allowed origin pattern currently forces a hyphen after "chaewons-projects"
which prevents matching actual Vercel preview domains; update the pattern to
allow either no hyphen or any suffix after "chaewons-projects" (e.g., make the
portion after "projects" optional or use a wildcard immediately following
"projects") so preview domains like
https://withus-git-브랜치-chaewons-projects.vercel.app are accepted by CORS.

Copy link
Copy Markdown
Member

@EunjinWoo EunjinWoo left a comment

Choose a reason for hiding this comment

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

래빗이가 말한게 문제되지 않는다면 좋은 것 같아용 고생하셨어요!!

Copy link
Copy Markdown
Member

@SeongHo5356 SeongHo5356 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️chore 수정, 빌드, 배포 관련

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚙️ CORS 설정 추가

3 participants