Skip to content

Instantly share code, notes, and snippets.

@krancour
Created March 11, 2019 15:04
Show Gist options
  • Save krancour/02d81675b1e3ef001091abed7e76dba4 to your computer and use it in GitHub Desktop.
Save krancour/02d81675b1e3ef001091abed7e76dba4 to your computer and use it in GitHub Desktop.
type HTTPReverseProxy interface {
Proxy(w http.ResponseWriter, r *http.Request)
}
type httpReverseProxy struct {}
func NewHTTPReverseProxy() HTTPReverseProxy {
return &httpReverseProxy{}
}
func (h *httpReverseProxy) Proxy(w http.ResponseWriter, r *http.Request) {
if r.ProtoMajor == 2 {
// Handle HTTP/2 requests
// ...
} else {
// Handle HTTP/1.x requests
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment