pi-web-preview / README.md
Mike0021's picture
Pi Web direct previews: streaming relay
7bd88f8 verified
|
Raw History Blame Contribute Delete
1.08 kB
metadata
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 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/<cap>/), 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.