Skip to content

Instantly share code, notes, and snippets.

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