Skip to content

Instantly share code, notes, and snippets.

@ukd1
Created November 5, 2014 17:49
Show Gist options
  • Save ukd1/9ed950dbc24de6d70241 to your computer and use it in GitHub Desktop.
Save ukd1/9ed950dbc24de6d70241 to your computer and use it in GitHub Desktop.
A simple http proxy in go
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
director := func(req *http.Request) {
body, err := httputil.DumpRequest(req, false)
log.Println(req.URL, body, err)
}
r := &httputil.ReverseProxy{
Director: director,
}
http.ListenAndServe(":3128", r)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment