Does Go's HTTP/2 code work in plaintext mode?

386 views
Skip to first unread message

carl.mas...@gmail.com

unread,
Feb 6, 2016, 12:58:16 PM2/6/16
to golang-nuts
I have an HTTP server that terminates TLS connections from the Internet, and have been running with recent builds of Go.  It currently accepts HTTP/2 connections which is pretty cool, but it itself is basically just delegates the rest of the connection to another locally running Go server.  I am using the net/http/httputil reverse proxy for this.  I would prefer to use a Unix Domain Socket for the backend server to accept connection from the TLS terminator, to keep the amount of latency down.  Currently it's just using a localhost socket.

My question is: Can the httputil.ReverseProxy work with a unix socket instead of a tcp/ip one, and can the connection be in plaintext if the incoming request was HTTP/2?  Reading the source, it seems that ReverseProxy take explicit measures to use HTTP/1.1.

Brad Fitzpatrick

unread,
Feb 6, 2016, 2:11:15 PM2/6/16
to carl.mas...@gmail.com, golang-nuts
If you want to do http2 over something other than TCP+TLS, you need to wire it up manually yourself. 


On Sat, Feb 6, 2016 at 8:41 AM, <carl.mas...@gmail.com> wrote:
I have an HTTP server that terminates TLS connections from the Internet, and have been running with recent builds of Go.  It currently accepts HTTP/2 connections which is pretty cool, but it itself is basically just delegates the rest of the connection to another locally running Go server.  I am using the net/http/httputil reverse proxy for this.  I would prefer to use a Unix Domain Socket for the backend server to accept connection from the TLS terminator, to keep the amount of latency down.  Currently it's just using a localhost socket.

My question is: Can the httputil.ReverseProxy work with a unix socket instead of a tcp/ip one, and can the connection be in plaintext if the incoming request was HTTP/2?  Reading the source, it seems that ReverseProxy take explicit measures to use HTTP/1.1.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carl.mas...@gmail.com

unread,
Feb 11, 2016, 11:07:37 AM2/11/16
to golang-nuts, carl.mas...@gmail.com
Thanks for the response.  I know that the /x/ packages are not covered by the same API stability guarantees as the rest of Go, and from the looks of it, /x/net/http2 is copied into the main source directory.  Is /x/net/http2 just a staging ground until 1.6 is released, or is the general expectation that it will live on a little longer?

Brad Fitzpatrick

unread,
Feb 11, 2016, 11:39:32 AM2/11/16
to Carl M, golang-nuts
x/net/http2 will remain in x/net. There are no plans or desires to move it.

It will remain the kitchen sink import for people needing to do low-level http2 things.

The private copy if Go's std net/http will also remain, and be updated as needed at 1.n releases.

Reply all
Reply to author
Forward
0 new messages