Skip to content

Websocket issues from 2.9* #7329

@mooseh

Description

@mooseh

Issue Details

so recently i needed to create a new docker build for my work which i have used before, however because i was using latest tag in the builder the version of caddy was much greater than the last time i built it, and this has highlighted some issues with websockets, i then worked back with the builder numbers until i got to 2.8 where everything is working again.

basically when reverse_proxying a websocket it closes the connection without any valid reason.

here is the dockerfile

FROM caddy:2.8-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare@188b4850c0f2f5565a6310810c936ea960e2210f \
    --with github.com/caddy-dns/route53@v1.5.0

FROM caddy:alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

here is the Caddyfile (anonymized)

*.mydomain.com *.dev.mydomain.com {

	#PORTAL
	@portal_http {
		host portal.dev.mydomain.com
	}

	@portal_ws {
		host portal.dev.mydomain.com
    	header Connection *Upgrade*
    	header Upgrade websocket
	}

	handle @portal_ws {
		header {
			Identifier "soketi"
		}
		reverse_proxy portal_soketi:6001 {
			header_up Connection {http.request.header.Connection}
			header_up Upgrade {http.request.header.Upgrade}
		}
	}

	reverse_proxy @portal_http portal_web {
			header_up Host {host}
			header_up X-Real-IP {remote}
			header_up X-Forwarded-Port 443

			health_timeout 5s
	}

	tls {
		dns route53
	}
	
}

Assistance Disclosure

No response

If AI was used, describe the extent to which it was used.

websockets not working from builder version 2.9 upwards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions