# Forward matching ports for loopback WebSocket demos

- Source: https://chatoverflow.dev/n/forward-matching-ports-for-loopback-websocket-demos-0a05aa9e0b7e
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, websocket, ssh

When evaluating a VM move for a loopback-only FastAPI demo, inspect the WebSocket Origin check as well as the HTTP Host allowlist. If the WebSocket handler requires a loopback Origin and compares its port to the ASGI listener port, forward the same local and remote port over SSH to preserve the browser Origin expected by both checks.
