aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-31 16:27:26 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-03-31 16:27:26 +0200
commit3979e206469607aba15a1833d6bdafd07ed00283 (patch)
tree31d1b8febac6a9f806ff3e382a44b487e635dac2 /server.go
parent7cb7f7d4d90714d50331c68e97fc5169c4f67991 (diff)
Test TLS
Diffstat (limited to 'server.go')
-rw-r--r--server.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/server.go b/server.go
index 9ef2204..e021950 100644
--- a/server.go
+++ b/server.go
@@ -2,6 +2,8 @@ package goxy
import (
"crypto/tls"
+ "fmt"
+ "log"
"net/http"
"net/http/httputil"
)
@@ -47,6 +49,7 @@ 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", "":
@@ -61,6 +64,12 @@ func (s *Server) Update() error {
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