Allow to override target host header using subdomains

This commit is contained in:
Marcos Lilljedahl
2017-02-17 12:53:16 -03:00
parent f816be6f69
commit 9e57f3b61c
3 changed files with 42 additions and 47 deletions

6
api.go
View File

@@ -61,8 +61,8 @@ func main() {
}
// Specific routes
r.Host(`{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}-{port:[0-9]*}.{tld:.*}`).HandlerFunc(proxyMultiplexer)
r.Host(`{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}.{tld:.*}`).HandlerFunc(proxyMultiplexer)
r.Host(`{host:.*}{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}-{port:[0-9]*}.{tld:.*}`).HandlerFunc(proxyMultiplexer)
r.Host(`{host:.*}{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}.{tld:.*}`).HandlerFunc(proxyMultiplexer)
r.HandleFunc("/ping", handlers.Ping).Methods("GET")
r.HandleFunc("/sessions/{sessionId}", handlers.GetSession).Methods("GET")
r.Handle("/sessions/{sessionId}/instances", http.HandlerFunc(handlers.NewInstance)).Methods("POST")
@@ -110,7 +110,7 @@ func main() {
ssl := mux.NewRouter()
sslProxyHandler := handlers.NewSSLDaemonHandler()
ssl.Host(`{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}-2375.{tld:.*}`).Handler(sslProxyHandler)
ssl.Host(`{host:.*}{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}-2375.{tld:.*}`).Handler(sslProxyHandler)
log.Println("Listening TLS on port " + config.SSLPortNumber)
s := &http.Server{Addr: "0.0.0.0:" + config.SSLPortNumber, Handler: ssl}