diff --git a/cmd/server/main.go b/cmd/server/main.go index 7e4c9b4..23dad0f 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -76,9 +76,8 @@ func (tm *TunnelManager) FindSlugByConn(conn *gossh.ServerConn) (string, bool) { // HTTP Proxy to forward requests to the SSH tunnel func startHttpProxy(port string) { log.Printf("Starting HTTP Proxy on %s", port) - // Serve static files for 404 page - - http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./cmd/server/static/assets")))) + // Serve static files for 404 page (namespaced to avoid collision with user apps) + http.Handle("/_gw/", http.StripPrefix("/_gw/", http.FileServer(http.Dir("./cmd/server/static/assets")))) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Extract subdomain to identify the tunnel @@ -126,7 +125,7 @@ func startHttpProxy(port string) { // But typically `gliderlabs/ssh` is for allowing the server to be a jump host. // We want to be an HTTP Gateway. -// 1. Hijack the connection to handle bidirectional traffic (WebSockets) + // 1. Hijack the connection to handle bidirectional traffic (WebSockets) hijacker, ok := w.(http.Hijacker) if !ok { http.Error(w, "Hijacking not supported", http.StatusInternalServerError) diff --git a/cmd/server/static/404.html b/cmd/server/static/404.html index 97f2680..22a14cc 100644 --- a/cmd/server/static/404.html +++ b/cmd/server/static/404.html @@ -16,11 +16,11 @@ - +
@@ -49,7 +49,7 @@
- +