Skip to content

Instantly share code, notes, and snippets.

@aliuygur
Last active June 24, 2016 16:14
Show Gist options
  • Save aliuygur/00f27e80d92b71d2582b80685147edb0 to your computer and use it in GitHub Desktop.
Save aliuygur/00f27e80d92b71d2582b80685147edb0 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
u, _ := url.Parse("https://leanfoods-9f12.restdb.io")
director := func(r *http.Request) {
r.URL.Host = u.Host
r.URL.Scheme = u.Scheme
r.Host = u.Host
}
proxy := &httputil.ReverseProxy{Director: director}
http.ListenAndServe(":9000", proxy)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment