A secure proxy server for Scalar APIs, implemented as a single SvelteKit route and running on Bun. Handles CORS, preserves headers, blocks private network requests, and supports all HTTP methods.
proxyUrl
./ping
.openapi.yaml
from public/
.Make sure you have Bun installed.
bun install
Start the development server:
bun run dev
You can also open in a browser directly if your package.json
includes a dev script that runs SvelteKit:
npm run dev -- --open
In your Scalar Docs configuration:
export default {
title: 'My API Docs',
spec: {
url: '/openapi.yaml'
},
proxyUrl: 'https://some-proxy.domain.nl' // points to your hosted proxy instance
};
Make requests like:
GET /?scalar_url=https%3A%2F%2Fledenpas.hub.allunited.dev%2Fapi%2Fendpoint
bun run build
You can preview the production build with:
bun run preview
To deploy, use a SvelteKit adapter suitable for your environment (e.g., Node, Cloudflare, Vercel).
Origin
headers and supports credentials for proper browser access.