Skip to content

Instantly share code, notes, and snippets.

@hogelog
Created October 9, 2013 14:46
Show Gist options
  • Save hogelog/6902485 to your computer and use it in GitHub Desktop.
Save hogelog/6902485 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func connectReverseProxy(connectUrl string, port int) {
u, _ := url.Parse(connectUrl)
reverseProxy := httputil.NewSingleHostReverseProxy(u)
s := &http.Server{
Addr: ":8080",
Handler: reverseProxy,
}
log.Fatal(s.ListenAndServe())
}
func main() {
connectReverseProxy("http://cookpad.com", 8080)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment