Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/KUSITMS/WITHUS/global/config/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public CorsFilter corsFilter() {
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.


config.addAllowedMethod("*");
config.addAllowedHeader("*");
Expand Down
Loading