From adb7c8246eb25554012bc74c271feed1101bbbc8 Mon Sep 17 00:00:00 2001 From: Noah Levenson Date: Fri, 2 Dec 2022 13:30:43 -0500 Subject: [PATCH] workaround for webkit websocket compression bug (#45) --- egress/egress.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/egress/egress.go b/egress/egress.go index c3871a1..fe82950 100644 --- a/egress/egress.go +++ b/egress/egress.go @@ -65,7 +65,17 @@ func (l proxyListener) Addr() net.Addr { func (l proxyListener) handleWebsocket(w http.ResponseWriter, r *http.Request) { // TODO: InsecureSkipVerify=true just disables origin checking, we need to instead add origin // patterns as strings using AcceptOptions.OriginPattern - c, err := websocket.Accept(w, r, &websocket.AcceptOptions{InsecureSkipVerify: true}) + // TODO: disabling compression is a workaround for a WebKit bug: + // https://github.com/getlantern/broflake/issues/45 + c, err := websocket.Accept( + w, + r, + &websocket.AcceptOptions{ + InsecureSkipVerify: true, + CompressionMode: websocket.CompressionDisabled, + }, + ) + if err != nil { // TODO: this is the idiom for our WebSocket library, but we should log the err better fmt.Println(err)