Skip to content

net/http/httputil: add WebSocket support to ReverseProxy #26937

Closed
@bradfitz

Description

@bradfitz

Add WebSocket support to ReverseProxy.

I have code for this that I use myself in various projects, but I keep forgetting to add it to Go.

Activity

added
NeedsFixThe path to resolution is known, but the work has not been done.
on Aug 12, 2018
added this to the Go1.12 milestone on Aug 12, 2018
self-assigned this
on Aug 12, 2018
nhooyr

nhooyr commented on Aug 12, 2018

@nhooyr
Contributor

This would need to be off by default in case current clients rely on the lack of support to prevent websocket connections.

bradfitz

bradfitz commented on Aug 12, 2018

@bradfitz
ContributorAuthor

@nhooyr, that seems like a stretch. We'd document it in the release notes and say how to disable it if people wanted to. But if the two sides negotiate it and the Go user expressed their intent to wire up the two sides with a ReverseProxy, I don't think it's crazy to say we'd wire it up all the way.

nhooyr

nhooyr commented on Aug 12, 2018

@nhooyr
Contributor

@bradfitz Fair enough. Its extremely unlikely anyone would not want WebSockets support anyway.

nhooyr

nhooyr commented on Aug 12, 2018

@nhooyr
Contributor

@bradfitz Could you post the code for this, I've written something similar myself, want to make sure I'm doing it right.

nhooyr

nhooyr commented on Aug 12, 2018

@nhooyr
Contributor

We should also support arbitrary upgrades instead of just WebSockets.

nhooyr

nhooyr commented on Aug 12, 2018

@nhooyr
Contributor

@bradfitz In fact, if you post it, I'd love to work on the CL for this.

bradfitz

bradfitz commented on Aug 12, 2018

@bradfitz
ContributorAuthor

@nhooyr, I'll send it myself, as I already have the code. It won't save me any time to hand it to you to hand back to me. You can review it once it's on Gerrit, though.

gopherbot

gopherbot commented on Aug 24, 2018

@gopherbot
Contributor

Change https://golang.org/cl/131279 mentions this issue: net/http: make Transport return Writable Response.Body on WebSocket upgrade

bradfitz

bradfitz commented on Aug 24, 2018

@bradfitz
ContributorAuthor

I decided to implement this a different way, not using my existing code. Instead, I sent https://golang.org/cl/131279 to add Transport support for WebSockets, so the ReverseProxy code won't need to separately dial the backend.

41 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@jrefior@dmitshur@gopherbot@nhooyr

        Issue actions

          net/http/httputil: add WebSocket support to ReverseProxy · Issue #26937 · golang/go