v147 · Security · WebSockets

Compatibility Lab

Detects WebSocket API availability, classifies page origin context (public / private / loopback), and probes whether LNA enforcement applies to WebSocket connections from this page. Provides the server-side WebSocket upgrade preflight pattern and the connection error detection strategy.

API probes

WebSocket LNA enforcement matrix

Page originWebSocket targetChrome 147 result
Public (https://example.com)ws://localhost:8080BLOCKED — LNA preflight required
Public (https://example.com)ws://192.168.1.100BLOCKED — LNA preflight required
Public (https://example.com)ws://192.168.1.100:443BLOCKED — LNA preflight required
Private (http://192.168.x.x)ws://192.168.1.100ALLOWED — same tier
Localhost (http://localhost)ws://localhost:8080ALLOWED — loopback to loopback
Public (https://example.com)wss://example.comALLOWED — public to public

Live context probe

WebSocket API + context check
Click "Run probe" to inspect WebSocket context…

Server-side fix pattern

/* WebSocket LNA preflight (server-side) */ /* The browser sends an HTTP upgrade request with: Access-Control-Request-Private-Network: true when a public page opens a WebSocket to a private IP. */ /* Node.js ws server — handle LNA preflight */ const { WebSocketServer } = require('ws'); const http = require('http'); const server = http.createServer((req, res) => { // Handle the LNA OPTIONS preflight if (req.method === 'OPTIONS' && req.headers['access-control-request-private-network']) { res.writeHead(200, { 'Access-Control-Allow-Origin': req.headers.origin || '*', 'Access-Control-Allow-Private-Network': 'true', 'Access-Control-Allow-Headers': 'Upgrade, Connection', }); res.end(); return; } res.writeHead(404); res.end(); }); const wss = new WebSocketServer({ server }); wss.on('connection', (ws, req) => { ws.send('LNA-allowed WebSocket connected'); }); server.listen(8080); /* Client — detect LNA block */ function createPrivateWebSocket(url) { const ws = new WebSocket(url); ws.addEventListener('error', (e) => { console.error('WebSocket failed — may be LNA block.'); console.error('Ensure server sends Access-Control-Allow-Private-Network: true'); }); return ws; }

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗