932bc192fad99dcc188b6b67660a3c612909a9a5
feat: update Home component with new UI elements and improved request handling chore: add components.json for component configuration feat: implement Badge component for status indication feat: create Button component for consistent styling feat: develop Card component structure for content display feat: add Input component for user input fields feat: implement Label component for form accessibility feat: create Select component for dropdown functionality feat: add Separator component for visual separation feat: implement Toaster component for notifications feat: create Tabs component for tabbed navigation feat: add Textarea component for multi-line input feat: add utility functions for class name management
Edge Relay
HTTP proxy untuk Vercel Edge Runtime.
Cara Pakai
Header yang Dibutuhkan
| Header | Required | Default | Deskripsi |
|---|---|---|---|
x-relay-target |
Yes | - | URL target yang ingin di-proxy |
x-relay-path |
No | / |
Path yang ditambahkan ke target |
Contoh
# Proxy ke httpbin.org/get
curl -H "x-relay-target: https://httpbin.org" https://your-edge-function.vercel.app
# Proxy ke endpoint spesifik
curl -H "x-relay-target: https://api.example.com" \
-H "x-relay-path: /v1/users" \
https://your-edge-function.vercel.app
HTTP Methods
Mendukung semua HTTP methods:
GET,HEAD- tanpa bodyPOST,PUT,PATCH,DELETE- dengan body
Header Handling
Relay headers yang di-strip sebelum forwarded:
x-relay-targetx-relay-pathhost
Headers lain tetap di-pass.
Error Handling
{
"error": "Missing x-relay-target header"
}
HTTP 400 jika x-relay-target tidak ada.
Struktur Kode
proxy-vercel/
├── index.ts # Edge handler
├── relay-utils.ts # Pure functions untuk relay logic
└── index.test.ts # Unit tests
relay-utils.ts
| Function | Deskripsi |
|---|---|
normalizeTargetUrl(target, path) |
Gabung target + path, hapus trailing slash |
stripRelayHeaders(headers) |
Hapus relay-specific headers |
shouldSendBody(method) |
Cek apakah method butuh body |
buildRelayRequest(req, url, headers) |
Bangun RequestInit untuk fetch |
createRelayResponse(response) |
Buat Response dari fetch result |
Development
bun test # Run tests
bun run index.ts # Start local server (untuk manual testing)
Languages
TypeScript
95.3%
HTML
4.6%
Dockerfile
0.1%