Add Vercel backend rewrites#29
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 39 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
Walkthrough새로운 Changes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@vercel.json`:
- Line 5: The rewrite destination currently points to an HTTP URL with a fixed
public IP ("destination": "http://34.64.182.89:8081/:path*"); update it to use
an HTTPS domain-based endpoint and remove the hardcoded IP (e.g., switch to an
HTTPS host like https://api.example.com/:path*), and make the target
configurable via an environment variable (referenced conceptually as
VITE_BE1_BASE_URL) so production/staging can differ; locate the "destination"
entries in vercel.json and replace the HTTP IP values with an HTTPS domain
reference that will be supplied via env var.
- Around line 2-11: The production deployment is bypassing vercel.json rewrites
because apiConfig.ts returns absolute URLs from VITE_BE1_BASE_URL and
VITE_BE3_BASE_URL (per .env.example), so axios calls go directly to the backend;
fix by either (A) configuring production env vars VITE_BE1_BASE_URL and
VITE_BE3_BASE_URL to use the relative base paths "/be1" and "/be3" so
apiConfig.ts continues to return those relative paths and Vercel rewrites in
vercel.json apply, or (B) remove/disable vercel.json rewrites and update
documentation/.env.example to require absolute backend URLs for direct access;
update apiConfig.ts behavior and .env.example accordingly to keep the chosen
approach consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| "rewrites": [ | ||
| { | ||
| "source": "/be1/:path*", | ||
| "destination": "http://34.64.182.89:8081/:path*" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Vercel rewrites에서 외부 destination으로 HTTP(비TLS) 사용 시 권장/제약 사항이 무엇인지, 그리고 프로덕션에서 HTTPS 사용 권장 근거를 공식 문서 기준으로 확인해줘.
💡 Result:
Vercel rewrites에서 외부 destination으로 HTTP(비TLS) 사용 시 공식 문서상 명시적인 제약이나 금지는 없으나, 모든 예시와 설명에서 https://를 사용하며 HTTP는 권장되지 않습니다. 프로덕션에서 HTTPS 사용이 강력히 권장되며, 이는 보안(데이터 암호화, MITM 방지), 성능(CDN 캐싱 지원), 표준 준수 이유입니다. 권장/제약 사항: - 공식 문서(https://vercel.com/docs/routing/rewrites, https://vercel.com/docs/project-configuration/vercel-json)에서 external rewrites 예시는 항상 "https://api.example.com" 형식. HTTP 예시 없음. - Next.js rewrites 등 프레임워크별에서도 HTTPS만 예시. Self-signed HTTPS는 dev에서 cert 오류 발생하나 프로덕션에서는 유효 cert 필요. - HTTP destination 지원 여부 명시 안 됨. 테스트 필요하나, 보안 정책상 프로덕션에서 HTTP 차단될 가능성 높음 (TLS 1.2/1.3만 지원, 모든 배포 HTTPS 강제). - 캐싱: External rewrites에서 upstream cache-control 존중하나, 프로덕션 최적화 위해 HTTPS 필수. 프로덕션 HTTPS 권장 근거 (공식 문서 기준): - 보안: Vercel CDN이 reverse proxy 역할 시 데이터 암호화 필수. HTTP는 평문 노출 위험 (MITM, 데이터 유출). - 성능: External rewrites 캐싱 기본 활성화(2026-04-06 이후 프로젝트). HTTPS에서만 안정적 CDN 캐싱/최적화. - 표준: 모든 Vercel 도메인 자동 HTTPS/TLS 제공. Custom 도메인도 HTTPS 권장 (Redirects 문서: "Prioritize HTTPS"). Enterprise만 custom SSL. - 규정 준수: PCI DSS 등에서 HTTPS 필수. Bulk redirects/project rules에서도 external dest "https://" 예시. 결론: 프로덕션에서는 HTTP 대신 HTTPS 사용 필수. HTTP 시 연결 실패/보안 경고 발생 가능. Dev에서만 self-signed 허용 논의 중(Next.js issue).
Citations:
- 1: https://vercel.com/docs/routing/rewrites
- 2: https://vercel.com/docs/edge-network/rewrites
- 3: https://vercel.co/docs/rewrites
- 4: https://vercel.com/docs/routing/project-routing-rules
- 5: https://vercel.com/docs/project-configuration/vercel-json
- 6: https://vercel.com/kb/guide/vercel-reverse-proxy-rewrites-external
- 7: https://vercel.com/docs/rewrites
- 8: https://www.vercel.com/docs/routing/rewrites
HTTP + 고정 IP는 Vercel rewrites의 프로덕션 환경에서 권장되지 않습니다. HTTPS 기반 도메인 엔드포인트로 변경하세요.
Line 5, Line 9의 destination이 HTTP 및 고정 공인 IP(34.64.182.89)로 설정되어 있습니다. Vercel 공식 문서에서 external rewrites 모든 예시는 HTTPS를 사용하며, HTTP는 프로덕션에서 다음 이유로 권장되지 않습니다:
- 보안: TLS 암호화 없음으로 인한 MITM 공격 위험, 데이터 평문 노출
- 성능: CDN 캐싱 및 최적화 미지원 (HTTPS 기반만 지원)
- 운영 유연성: 고정 IP 하드코딩으로 스테이징/프로덕션 환경 분리 불가
HTTPS 도메인 기반으로 변경하고, 환경별 설정은 환경 변수(예: VITE_BE1_BASE_URL)를 활용하세요.
수정 예시
{
"rewrites": [
{
"source": "/be1/:path*",
- "destination": "http://34.64.182.89:8081/:path*"
+ "destination": "https://be1-backend.example.com/:path*"
},
{
"source": "/be3/:path*",
- "destination": "http://34.64.182.89:8083/:path*"
+ "destination": "https://be3-backend.example.com/:path*"
}
]
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vercel.json` at line 5, The rewrite destination currently points to an HTTP
URL with a fixed public IP ("destination": "http://34.64.182.89:8081/:path*");
update it to use an HTTPS domain-based endpoint and remove the hardcoded IP
(e.g., switch to an HTTPS host like https://api.example.com/:path*), and make
the target configurable via an environment variable (referenced conceptually as
VITE_BE1_BASE_URL) so production/staging can differ; locate the "destination"
entries in vercel.json and replace the HTTP IP values with an HTTPS domain
reference that will be supplied via env var.
Summary
해당 PR에 대한 작업 요약을 작성해주세요.
Tasks
Summary by CodeRabbit
릴리스 노트