Skip to content

Instantly share code, notes, and snippets.

@cheikhsimsol
Created February 14, 2024 05:44
Show Gist options
  • Save cheikhsimsol/bac13e7b07be4457377863a5b5740637 to your computer and use it in GitHub Desktop.
Save cheikhsimsol/bac13e7b07be4457377863a5b5740637 to your computer and use it in GitHub Desktop.
target, _ := url.Parse("http://localhost:8081/base/")
// Create a reverse proxy
proxy := &httputil.ReverseProxy{
Rewrite: func(r *httputil.ProxyRequest) {
log.Println("Forwarding:", r.In.URL.String())
r.SetURL(target)
r.Out.Host = r.In.Host
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment