I have an HTTP Proxy configured that only accepts HTTP CONNECT requests to 
proxy requests to upstream servers, with some upstream servers using HTTPS 
and some using HTTP. However, the behavior in 
https://golang.org/src/net/http/transport.go around line 1638 makes it so 
that HTTP CONNECT tunnels are only used when the request URL uses the 
“https” scheme. My code currently sets the Proxy field on the 
http.Transport struct to send requests through my proxy server, and all 
works as expected for requests using the “https” scheme, but it’s not doing 
so for the requests using “http”.

Since the purpose of HTTP CONNECT is to create a TCP connection to the 
upstream server and then proxy bytes over the connection, it seems equally 
useful for both HTTP and HTTPS upstream servers, however I haven’t found a 
way to get this behavior using http.Transport. Is my only option to copy 
much of the implementation within http.Transport, or is there a way to 
signal that I’d always like to use HTTP CONNECT to proxy these requests? 
Supporting schemes like “http+connect” and “https+connect” seems like a 
fairly natural way to signal this without breaking the current interfaces.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b4263911-df8a-4395-8da4-b1f851207cd5n%40googlegroups.com.

Reply via email to