blob: 30fe0b89ca050062caff2a8cd911bfe8eb91eb52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
}
|