Skip to content

Instantly share code, notes, and snippets.

@wader
Created February 17, 2018 17:51
Show Gist options
  • Save wader/e069d21cf6ad2f968b0507a3e0b2d421 to your computer and use it in GitHub Desktop.
Save wader/e069d21cf6ad2f968b0507a3e0b2d421 to your computer and use it in GitHub Desktop.
package main
import (
"crypto/tls"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
targetURL, _ := url.Parse("http://bla")
proxy := httputil.NewSingleHostReverseProxy(targetURL)
srv := http.Server{
Addr: ":8080",
TLSConfig: &tls.Config{
ClientAuth: tls.RequireAndVerifyClientCert,
},
Handler: proxy,
}
srv.ListenAndServeTLS("certfile", "keyfile")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment