Route Proxy Demo
This is a demo of a proof of concept feature published here and unlikely to get merged without major discussion. It was coded fully with Claude Opus 4.6
This app demonstrates vinext route proxies — proxy.ts files that intercept requests at each directory level, cascading from root to leaf.
Route-Level Proxies
- /about — Route proxy sets
x-about-route-proxyheader. Global middleware also runs, demonstrating coexistence. - /proxy-test — Root proxy test (sets
x-route-proxy-rootheader) - /proxy-test/nested — Both root and nested proxies run, proving root-to-leaf cascade
- /proxy-test/blocked — Proxy blocks the request, returning 403 before page renders
- /proxy-test/rewrite-test — Proxy rewrites to /about (URL stays, content changes)
- /proxy-test/redirect-test — Proxy redirects to /about (302)
- /proxy-test/matcher-test — Proxy with
config.matcher(only runs on this exact path) - /proxy-test/matcher-test/excluded — Excluded from matcher: proxy does NOT run on this sub-path
Deep Nesting (8-Level Proxy Chain)
- /deeply/nested/route/with/proxy/at/each/level — 8 proxies cascade root-to-leaf, each setting a response header (
x-proxy-deeplythroughx-proxy-level)
API Route Proxy
- /api/proxy-api-test — API route blocked by proxy before route handler executes (returns 403)
Global Middleware (Root proxy.ts)
/middleware-redirect— Redirects to /about with a cookie/middleware-blocked— Returns 403 "Blocked by middleware"