aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-31 19:03:12 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-03-31 19:03:12 +0200
commit2dabd37069d8495d7cf131f1bb749da5380ba846 (patch)
tree272718fcff1cc7051d5aa17e68c1bd3f96e3edca /server.go
parent82d5ec96afadf1b8ba26ccdc2bc901a420c8be64 (diff)
Add tests for 500/404
Diffstat (limited to 'server.go')
-rw-r--r--server.go11
1 files changed, 1 insertions, 10 deletions
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