I'm going to try my best to explain everything, new to server stuff! Everything is in Go and the main issue is with the ServeHTTP.
Problem
I'm working on forwarding requests received by (http.server).ListenAndServe() to be sent to another proxy server via (http.ReverseProxy).ServeHTTP(http.ResponseWriter, *http.Request). I'm using the python requests to submit a GET request and proxy it through the first server and the second server, to the actual target. I have been able to submit and receive http requests, but I cannot submit https requests.
Error
I constantly receive 502 bad gateway from the python request library, likely a result of http: proxy error: unsupported protocol scheme "" from ServeHTTP() when I use https://httpbin.org or any other https site. Using http results in the html being returned to me.
Response differences
The difference in *http.Response is for http is
&{GET http://httpbin.org HTTP/1.0 1 0 map[] <nil> <nil> 0 [] true http://httpbin.org map[] map[] <nil> map[] [my ip address] http://httpbin.org <nil> <nil> <nil> 0xc000050fc0}
and https is
&{CONNECT //httpbin.org:443 HTTP/1.0 1 0 map[] <nil> <nil> 0 [] true httpbin.org:443 map[] map[] <nil> map[] [my ip address] httpbin.org:443 <nil> <nil> <nil> 0xc0000503c0}
Here is a link to the documentation for *http.Request
What I've previously tried
I've tried modifying ReverseProxy.Director attribute and having the function modify the *http.Request. I've done everything from removing the ":443" and adding "https://" or even "http://". Doing this results in a bad request error. I've also tried changing the CONNECT request to a GET or POST, both of which had strange results including invalid method or bad request.
Any help?