⚙️ CORS 허용 Origin 추가 #151
Conversation
WalkthroughCORS 설정에 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
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. Comment |
| for (int port = 3000; port <= 3010; port++) { | ||
| config.addAllowedOriginPattern("http://localhost:" + port); | ||
| } | ||
| config.addAllowedOriginPattern("https://withus-*-chaewons-projects-*.vercel.app"); |
There was a problem hiding this comment.
와일드카드 패턴이 실제 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.
| 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.
EunjinWoo
left a comment
There was a problem hiding this comment.
래빗이가 말한게 문제되지 않는다면 좋은 것 같아용 고생하셨어요!!
✨ Related Issue
📌 Task Details
💬 Review Requirements (Optional)
Summary by CodeRabbit