From 2dabd37069d8495d7cf131f1bb749da5380ba846 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 31 Mar 2016 19:03:12 +0200 Subject: Add tests for 500/404 --- server.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'server.go') diff --git a/server.go b/server.go index c2c3247..44defa8 100644 --- a/server.go +++ b/server.go @@ -2,8 +2,6 @@ package goxy import ( "crypto/tls" - "fmt" - "log" "net/http" "net/http/httputil" ) @@ -48,7 +46,6 @@ func (s *Server) Update() error { tlsMux := http.NewServeMux() for _, v := range s.Route { host := v.ServerName.Host + v.ServerName.Path - log.Println("Update", host) up := v.Upstream switch v.ServerName.Scheme { case "http", "": @@ -57,18 +54,12 @@ func (s *Server) Update() error { wwwMux.Handle(host, http.RedirectHandler("https://"+host, http.StatusMovedPermanently)) tlsMux.Handle(host, httputil.NewSingleHostReverseProxy(up)) case "ws": - wwwMux.Handle(host, http.RedirectHandler("wss://"+host, http.StatusMovedPermanently)) wwwMux.Handle(host, NewWebSocketProxy(up)) case "wss": + wwwMux.Handle(host, http.RedirectHandler("wss://"+host, http.StatusMovedPermanently)) tlsMux.Handle(host, NewWebSocketProxy(up)) } } - wwwMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "%q", r) - }) - tlsMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "%q", r) - }) s.wwwServer.Handler = wwwMux s.tlsServer.Handler = tlsMux return nil -- cgit v1.2.3