Using long live websocket connection

1. Caddy version (caddy version):

2

2. How I run Caddy:

a. System environment:

OS: Mac OS Monterey M1
docker desktop version: 20.10.11

b. Command:

docker compose up

c. Service/unit/compose file:

version: "3.4"
services:
  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config

d. My complete Caddyfile or JSON config:

ws.domain {
    @websockets {
        header Connection *Upgrade*
        header Upgrade websocket
    }    
    reverse_proxy @websockets wsserver:8090
}

3. The problem I’m having:

Websocket disconnect after 1min

4. Error messages and/or full log output:

5. What I already tried:

I want to websocket client keep alive in longtime

6. Links to relevant resources:

Which version, exactly? It matters.

Are you sure it’s Caddy disconnecting the websocket connections? You’re sure it’s not the client or the upstream server? What’s your evidence of that?

Do you have a ping-pong mechanism between the client and websocket server? Usually that’s used to check for liveness of the connection, to keep it alive.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.