Rename internal asset path to /_gw/ to avoid collision with user apps
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user