func main() {
if err != nil {
panic(err)
}
go func() {
}()
proxy := httputil.NewSingleHostReverseProxy(backend)
proxy.Transport = &http.Transport{
Dial: func(network, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(network, addr, 5*time.Second)
if err != nil {
return conn, err
}
return conn, err
},
DisableKeepAlives: false,
MaxIdleConnsPerHost: 200,
}
http.HandleFunc("/", handler(proxy))
err = http.ListenAndServe(":3003", nil)
if err != nil {
panic(err)
}
}
func handler(p *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-VCAP", "TEST")
p.ServeHTTP(w, r)
}
}