Inspect a WebSocket URL and see the HTTP handshake it produces, with the mixed-content rule and the missing Authorization header explained.
Waiting for a URL
A WebSocket URL uses the ws: or wss: scheme.
The handshake is an HTTP request. A proxy that rewrites the path, strips the Upgrade header or enforces a timeout will break the connection before the socket exists.
The browser API cannot set headers. That is why tokens end up in the query string — and why they end up in access logs. A short-lived ticket, or the first message after open, keeps them out.
Waiting for a URL
Enter a ws: or wss: URL on the left.
WebSocket URL Builder runs entirely on your device — no socket is opened and no host is contacted.
You’re on the Free plan. Compare plans
A WebSocket connection starts as an HTTP request. The client sends a normal GET with `Upgrade: websocket`, and the server answers `101 Switching Protocols`. Everything that governs an HTTP request on that path governs the handshake too — a proxy, a path rewrite, a WAF rule, a timeout — which is why the handshake is shown here as the request it actually is.
`ws:` is plain text, and a page served over HTTPS cannot open one: browsers block it as mixed content, silently as far as the user is concerned. `wss:` is the only scheme worth using anywhere, including in development, where the difference between the two environments is itself a source of bugs.
The browser's WebSocket API provides no way to set request headers, which is why tokens end up in the query string — and therefore in proxy logs, access logs and anything else that records URLs. The alternatives are a cookie, which the handshake does send, or a short-lived ticket fetched over HTTP and sent as the first message after the connection opens.
Subprotocols are negotiated through `Sec-WebSocket-Protocol`, and the server must echo one back. A server that ignores the header leaves the client expecting a protocol it did not get, which usually appears as messages the client cannot parse rather than as a connection failure.
Nothing is connected. The URL is parsed as text, no socket is opened and no host is contacted.
If the page is served over HTTPS, the browser blocks it as mixed content. Use wss:. The failure is usually silent from the page's point of view, which is why it is confusing.
Not with an Authorization header — the browser API cannot set one. A cookie works, since the handshake is an HTTP request. Otherwise fetch a short-lived ticket over HTTP and send it as the first message, which keeps it out of URLs and logs.
Yes. URLs are recorded by proxies, load balancers and access logs in a way headers often are not. If you must do it, make the token short-lived and single-use.
The server's agreement to stop speaking HTTP on that connection and start speaking WebSocket. Anything other than 101 — including a 200 — means the upgrade did not happen, often because a proxy stripped the Upgrade header.
No. Nothing is contacted. The URL is parsed as text and the handshake is constructed from it.