This commit is contained in:
Tony Biondo 2025-10-15 14:53:19 -04:00 committed by Francis Lavoie
parent d676d9a82e
commit d474fbd3aa

View file

@ -413,7 +413,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
// websocket over http2 or http3, assuming backend doesn't support this, the request will be modified to http1.1 upgrade
// TODO: once we can reliably detect backend support this, it can be removed for those backends
if (r.ProtoMajor == 2 && r.Method == http.MethodConnect && r.Header.Get(":protocol") == "websocket") ||
(r.ProtoMajor == 3 && r.Method == http.MethodConnect && r.Proto == "websocket") {
(r.ProtoMajor == 3 && r.Method == http.MethodConnect && r.Proto == "websocket") {
clonedReq.Header.Del(":protocol")
// keep the body for later use. http1.1 upgrade uses http.NoBody
caddyhttp.SetVar(clonedReq.Context(), "h2_websocket_body", clonedReq.Body)