feat: universal proxy (new approach)
[!NOTE] High Risk High risk because it changes security-sensitive proxy/CORS behaviour (SSRF protections, header forwarding, redirect handling) and introduces a new WS proxy path; mistakes could leak credentials or open SSRF vectors.
Overview Switches the backend to a new universal proxy implementation:
/v1/proxynow supports header passthrough viaX-Proxy-Passthrough-*, redirect controls, streaming with caps/timeouts, SSRF/DNS pinning, and adds a new/v1/proxy/wsrelay with subprotocol-encoded targets.Adds proxy observability via
proxy_request/proxy_ws_relaystructured logs and OpenTelemetry span attributes, explicitly redacting full URLs/credentials while recording hostname, bytes, duration, status, and categorical error types.Introduces new authenticated APIs:
/v1/search(Exa-backed, normalises results to HTTPS and derives favicons) and/v1/preview(POST-only OG metadata extraction with HTTPS image upgrade and per-user 10‑minute private caching), plus new e2e tests.Removes the old
/pro/proxy,/pro/link-preview, and/mcp-proxyroutes and their tests, updates CORS toallowedHeaders: true(echo requested headers) and refreshescorsExposeHeadersdefaults/docs/env examples accordingly; also tweaks auth creation for test DI, sets Better AuthbaseURL, and adjusts dev tooling/lint globals/logger exports.Reviewed by Cursor Bugbot for commit c214826744a06192c9ad5f931e1af6c49d79c2b2. Bugbot is set up for automated code reviews on this repo. Configure here.
Semgrep Security Scan
No security issues found.
PR Metrics
| Metric | Value |
|---|---|
| Lines changed (prod code) | +2313 / -1266 |
| JS bundle size (gzipped) | :green_circle: 1.03 MB → 1.02 MB (-3.6 KB, -0.3%) |
| Test coverage | :green_circle: 72.06% → 72.22% (+0.2%) |
| Performance (preview) | Preview not ready — Render deploy may have timed out |
| Accessibility | — |
| Best Practices | — |
| SEO | — |
Updated Fri, 22 May 2026 17:27:36 GMT · run #1575
Preview environment destroyed 🧹
Stack preview-pr-837 and its Cloudflare subdomain have been cleaned up.