diff options
Diffstat (limited to 'proxy.go')
-rw-r--r-- | proxy.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/proxy.go b/proxy.go new file mode 100644 index 0000000..30fe0b8 --- /dev/null +++ b/proxy.go @@ -0,0 +1,22 @@ +package main + +import ( + "log" + "net/http" + "net/http/httputil" + "net/url" +) + +var reverseProxy *httputil.ReverseProxy + +func init() { + parsedURL, err := url.Parse(destHost) + if err != nil { + log.Fatal(err) + } + reverseProxy = httputil.NewSingleHostReverseProxy(parsedURL) +} + +func proxyRequest(writer http.ResponseWriter, request *http.Request) { + reverseProxy.ServeHTTP(writer, request) +} |