I'd like my app to proxy requests received by a particular handler to another server. I've tried the following, but the request seems to just stall:
u, _ := url.Parse("http://localhost:3000")
proxy := httputil.NewSingleHostReverseProxy(u)
frontendHandler = func(ctx context.Context) {
if err != nil {
ctx.Writef("Error starting dev server %v.", err)
return
}
proxy.ServeHTTP(ctx.ResponseWriter(), ctx.Request())
}
This is just meant to proxy frontend requests to the webpack dev server.