3 ms·
The inbuilt reverseproxy is also handy for small tasks: package main import ( "net/http" "net/http/httputil" "net/url" ) func
by farslan 13y ago
The inbuilt reverseproxy is also handy for small tasks:
package main
import (
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
target, _ := url.Parse("http://127.0.0.1:8000")
http.ListenAndServe(":80", httputil.NewSingleHostReverseProxy(target))
}
This will http proxy :80 to :8000.