Skip to main content
Use a custom preview proxy when your application needs its own domain, auth session, middleware, or WebSocket handling in front of a sandbox preview.

Generate a target

nullspace sandbox preview-proxy-target create sb_123 8080 \
  --transport http --transport websocket --json
The response includes marker-only upstream URLs and transport-specific header tokens. Store those token values in the proxy environment, not in browser code.

Samples

  • Node/Express: examples/custom-preview-proxy/node-express
  • Python/FastAPI: examples/custom-preview-proxy/python-fastapi
Both samples forward x-nullspace-preview-proxy-token on every upstream request, preserve the required forwarded headers, support WebSocket upgrades, and optionally forward x-nullspace-traffic-access-token when private traffic is enabled. They forward arbitrary subpaths and query strings so route refresh, relative redirects, static assets, and file-server paths continue through the same proxy.