diff --git a/server-proxy.go b/server-proxy.go index 3eb3083..668d000 100644 --- a/server-proxy.go +++ b/server-proxy.go @@ -491,6 +491,12 @@ func (pxy *server_proxy_xterm_file) ServeHTTP(w http.ResponseWriter, req *http.R RouteId: route_id, }) } + case "_redirect": + // shorthand for /_ssh/{conn_id}/_/ + // don't care about parameters following the path + status_code = http.StatusMovedPermanently; + w.Header().Set("Location", req.URL.Path + "_/"); + w.WriteHeader(status_code) case "_forbidden": status_code = http.StatusForbidden; w.WriteHeader(status_code) default: diff --git a/server.go b/server.go index 98a3d38..747d23a 100644 --- a/server.go +++ b/server.go @@ -1048,6 +1048,8 @@ func NewServer(ctx context.Context, logger Logger, ctl_addrs []string, rpc_addrs websocket.Handler(func(ws *websocket.Conn) { s.pxy_ws.ServeWebsocket(ws) })) s.pxy_mux.Handle("/_ssh/server-conns/{conn_id}/routes/{route_id}", s.wrap_http_handler(&server_ctl_server_conns_id_routes_id{server_ctl{s: &s, id: "pxy-ctl"}})) + s.pxy_mux.Handle("/_ssh/{conn_id}/", + s.wrap_http_handler(&server_proxy_xterm_file{server_proxy: server_proxy{s: &s, id: "pxy-file"}, file: "_redirect"})) s.pxy_mux.Handle("/_ssh/{conn_id}/{route_id}/", s.wrap_http_handler(&server_proxy_xterm_file{server_proxy: server_proxy{s: &s, id: "pxy-file"}, file: "xterm.html"})) s.pxy_mux.Handle("/_ssh/xterm.js",