Skip to content

Commit

Permalink
refactor: utilize Vercel Build Output API to reimplement API proxy
Browse files Browse the repository at this point in the history
This replaces Vercel Edge Middleware with the Vercel Build Output
API[^1] to reimplement the API proxy, cutting costs (no more
invocation-based charges), reducing latency (no middle layer or cold
starts), and simplifying the setup, while retaining dynamic
configuration via the `VERCEL_PROXIED_API_BASE_URL` environment
variable.

Updates goplus#804

[^1]: https://vercel.com/docs/build-output-api/v3

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
  • Loading branch information
aofei committed Aug 28, 2024
1 parent 9876343 commit 7dd1f8b
Show file tree
Hide file tree
Showing 7 changed files with 1,173 additions and 77 deletions.
2 changes: 1 addition & 1 deletion spx-gui/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ VITE_API_BASE_URL="/api"
# Features control
VITE_DISABLE_AIGC="false"

# This base URL is used by Vercel Edge Middleware to proxy all '/api/(.*)' requests.
# This base URL is used by Vercel to proxy all '/api/(.*)' requests.
# The path prefix '/api' is stripped before forwarding.
VERCEL_PROXIED_API_BASE_URL="https://goplus-builder.qiniu.io/api"
1 change: 1 addition & 0 deletions spx-gui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ tsconfig.tsbuildinfo
!.yarn/versions

.env.local
.vercel
16 changes: 0 additions & 16 deletions spx-gui/middleware.ts

This file was deleted.

Loading

0 comments on commit 7dd1f8b

Please sign in to comment.