--- title: Pi Web Preview emoji: 🪟 colorFrom: gray colorTo: gray sdk: docker app_port: 7860 pinned: false short_description: Direct previews of dev servers for Pi Web --- # Pi Web previews The origin that [Pi Web](https://mike0021-pi-web.hf.space) frames to show a user's own dev server (for example a Vite app on their machine's port 5173) natively, on a different site from Pi Web so app code can never act with the user's Pi Web session. There is nothing to open here directly: Pi Web asks its gateway for a capability link (`/__pv//`), this Space keeps it in a partitioned, HttpOnly cookie and relays every request to the gateway, which checks the capability and forwards to that user's machine only. Plain HTTP and server-sent events stream both ways; WebSocket upgrades (hot module reload sockets) are not supported. Only Pi Web may frame these pages (`frame-ancestors`). Configuration: secret `PREVIEW_RELAY_SECRET` (shared with the gateway Space), optional variables `PREVIEW_GATEWAY` (default `https://mike0021-pi-web.hf.space`) and `PREVIEW_FRAME_ANCESTORS`.