Slide 20
Slide 20 text
Go proxy
director := func(req *http.Request) {
xPrNumber := req.Header.Get("X-QA-PR")
apisPort := 3000
req.URL.Scheme = "http"
if xPrNumber != "" {
req.URL.Host = fmt.Sprintf("api-%s:%d", xPrNumber,
apisPort)
} else {
req.URL.Host = fmt.Sprintf("-api:%d", apisPort)
}
}
rp := &httputil.ReverseProxy{
Director: director,
}
rp.ServeHTTP(w, req)