WebSockets

Serve HTTP assets and WebSocket traffic on one hostname. Verify the upgrade handshake and confirm that the application origin accepts persistent connections.

Opening a WebSocket connection
Request
GET /events HTTP/1.1
Upgrade header
websocket
Response
101 Switching Protocols

Pass a connection upgrade through the edge

Cloud CDN supports WebSockets. Cached GET assets stay at the edge. WebSocket upgrades bypass cache and reach the origin.

Upgrade on the same hostname

Browsers can load JS from cache and open a WebSocket without a second domain.

Assets still hit cache

WebSocket support does not disable caching for the rest of the distribution.

TLS on the public name

wss:// uses the same certificate map as https://.

Configuration

Cloud CDN overview
  1. Front the app origin

    Pull the HTTP origin that already speaks WebSockets.

  2. Cache static paths

    JS, CSS and images stay cacheable.

  3. Allow the upgrade path

    The WebSocket URL bypasses cache and reaches origin.

  4. Test from more than one region

    Confirm upgrades, heartbeats and reconnects through the edge.

Operational outcomes

  • WebSockets share the site hostname
  • Static files remain cached
  • TLS is unified
  • Origin still owns socket state

Frequently asked questions

Are WebSocket messages cached?

No. The upgrade and the data plane are dynamic. Only ordinary HTTP GETs are cached.

Can I use Socket.IO?

If Socket.IO falls back to HTTP long-polling, those POSTs/GETs must bypass cache. The WebSocket transport upgrades dynamically.

Does this replace a realtime vendor?

No. Cloud CDN is the path to your origin. Presence, fan-out and channel logic stay in your app or vendor.

Are timeouts configurable?

Plan idle timeouts with your origin. Validate long-lived connections before production cutover.