A Shopify theme-embedded live-chat app uses a WebSocket at wss://client.websocket.com, but Shopify’s generated Content Security Policy (CSP) flags it under the current report-only policy. Because the policy lacks a connect-src directive, browsers fall back to default-src; an allowed https://*.websocket.com source does not cover the wss:// connection. The [network_access] validator also rejects wss:// entries, leaving developers without a way to declare the socket origin.
The connection still works while the policy is report-only, but it may be blocked if Shopify enforces the policy before adding WebSocket support. A suggested temporary workaround is HTTPS long polling, if the chat library supports it; this may be slower but can preserve functionality. The issue has also been posted on Shopify’s developer forum, where staff have answered related questions about wildcards. No confirmation or resolution for allowing wss:// sources has been reported, so the question remains open.
We’re testing the new [network_access] declaration with our live chat app (theme app embed), using a dev store with the network_access_testing feature preview.
Our chat widget opens a WebSocket to wss://client.websocket.com. Chrome and Firefox both report it as a violation of the generated Content-Security-Policy-Report-Only header:
Connecting to 'wss://client.websocket.com/...' violates the following Content Security Policy directive: "default-src 'self' ... https://*.websocket.com ...". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
The generated policy only has a default-src with https:// sources and no connect-src.
Browsers don’t treat https://*.websocket.com as covering wss:// hosts in this case.
The allowed_sources validator rejects wss:// entries: it must match ^https://....
So apps currently have no way to declare a WebSocket origin.
We’d need [network_access], allowed_sources to accept wss:// origins.
Could someone from the team confirm whether this is planned before the policy moves from report-only to enforced?
Hi @dinistav it looks right. In CSP an https:// source doesn’t match a wss:// URL and since the generated policy has no connect-src, the socket falls under default-src. So once Shopify switches this from Report-Only to enforced - the connection gets blocked unless they add wss:// support. For now it is only Report-Only so the widget still connects on live stores.
I would post this on the developer forum too, community.shopify.dev. Shopify staff answer network_access questions there. Yesterday one of them confirmed wildcards work in allowed_sources:
Meanwhile, if your chat library can fall back to HTTPS long polling (Socket.IO does), that goes over https:// and your existing entry covers it. Slower than a socket, but chat keeps working if enforcement lands before a fix