mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
stuff
This commit is contained in:
@@ -44,7 +44,9 @@ func main() {
|
||||
r.HandleFunc("/", ProxyFunc)
|
||||
|
||||
http.Handle("/", r)
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
port := 80
|
||||
fmt.Println("listening and serving on port", port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", port), nil))
|
||||
}
|
||||
|
||||
func ProxyFunc(w http.ResponseWriter, req *http.Request) {
|
||||
@@ -63,6 +65,7 @@ func ProxyFunc(w http.ResponseWriter, req *http.Request) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("proxying to", destUrl)
|
||||
proxy := httputil.NewSingleHostReverseProxy(destUrl)
|
||||
proxy.ServeHTTP(w, req)
|
||||
// todo: how to handle destination failures. I got this in log output when testing a bad endpoint:
|
||||
|
||||
Reference in New Issue
Block a user