fix: route frontend API through Vercel HTTP rewrite#68
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates the frontend deployment configuration to route /api/* requests through a Vercel rewrite, removing the need for a Vercel-hostname-specific API base URL override in the client.
Changes:
- Added a
vercel.jsonrewrite to forward/api/*requests to the backend origin. - Simplified
getApiBaseUrl()so production can rely on relative/api/*calls (rewrites/proxies) instead of hostname detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontend/vercel.json |
Introduces a Vercel rewrite to proxy frontend /api/* traffic to the backend. |
frontend/src/services/jobsService.ts |
Removes Vercel-hostname special-casing so API calls can use relative paths and be handled by the rewrite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "rewrites": [ | ||
| { | ||
| "source": "/api/(.*)", | ||
| "destination": "http://jobsglobalscraper.ddns.net/api/$1" |
There was a problem hiding this comment.
The rewrite destination is using plain HTTP. This means traffic between Vercel and the backend is unencrypted and can also lead to redirects/mixed-protocol issues (and some Vercel configurations only allow HTTPS external destinations). Prefer using an HTTPS destination if the backend supports it; if it doesn’t, consider terminating TLS in front of the backend (or proxying through a Vercel Function/Edge) rather than hard-coding an HTTP origin here.
| "destination": "http://jobsglobalscraper.ddns.net/api/$1" | |
| "destination": "https://jobsglobalscraper.ddns.net/api/$1" |
No description provided.