Skip to content

Instantly share code, notes, and snippets.

@robpe
Forked from montanaflynn/proxy.go
Last active August 29, 2015 14:18
Show Gist options
  • Save robpe/4fc7ca6dd66468731a55 to your computer and use it in GitHub Desktop.
Save robpe/4fc7ca6dd66468731a55 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
director := func(req *http.Request) {
req = r
req.URL.Scheme = "http"
req.URL.Host = r.Host
}
proxy := &httputil.ReverseProxy{Director: director}
proxy.ServeHTTP(w, r)
})
log.Fatal(http.ListenAndServe(":8181", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment