From 9424b8fcf54ad87bc1b34c946f7e0c168d7a919e Mon Sep 17 00:00:00 2001 From: Henry Barreto Date: Fri, 24 Jan 2025 17:32:58 -0300 Subject: [PATCH] feat(gateway,ssh,agent)!: rename http proxy handler endpoint --- gateway/nginx/conf.d/shellhub.conf | 2 +- pkg/agent/pkg/tunnel/tunnel.go | 2 +- ssh/pkg/tunnel/tunnel.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gateway/nginx/conf.d/shellhub.conf b/gateway/nginx/conf.d/shellhub.conf index 9ec3b6de8fb..40f75f857e5 100644 --- a/gateway/nginx/conf.d/shellhub.conf +++ b/gateway/nginx/conf.d/shellhub.conf @@ -680,7 +680,7 @@ server { location ~ ^/(?.*) { {{ set_upstream "ssh" 8080 }} - rewrite ^/(.*)$ /ssh/http break; + rewrite ^/(.*)$ /http/proxy break; proxy_set_header X-Request-ID $request_id; proxy_set_header X-Address $address; proxy_set_header X-Path /$path$is_args$args; diff --git a/pkg/agent/pkg/tunnel/tunnel.go b/pkg/agent/pkg/tunnel/tunnel.go index 308ef7e39ac..cb070ec3a48 100644 --- a/pkg/agent/pkg/tunnel/tunnel.go +++ b/pkg/agent/pkg/tunnel/tunnel.go @@ -76,7 +76,7 @@ func NewTunnel() *Tunnel { e.GET("/ssh/close/:id", func(e echo.Context) error { return t.SSHCloseHandler(e) }) - e.CONNECT("/ssh/proxy/:addr", func(e echo.Context) error { + e.CONNECT("/http/proxy/:addr", func(e echo.Context) error { // NOTE: The CONNECT HTTP method requests that a proxy establish a HTTP tunnel to this server, and if // successful, blindly forward data in both directions until the tunnel is closed. // diff --git a/ssh/pkg/tunnel/tunnel.go b/ssh/pkg/tunnel/tunnel.go index b5969333d76..f373c48a561 100644 --- a/ssh/pkg/tunnel/tunnel.go +++ b/ssh/pkg/tunnel/tunnel.go @@ -159,8 +159,7 @@ func NewTunnel(connection, dial, redisURI string) (*Tunnel, error) { return c.NoContent(http.StatusOK) }) - // TODO: Change this path. - tunnel.router.Any("/ssh/http", func(c echo.Context) error { + tunnel.router.Any("/http/proxy", func(c echo.Context) error { requestID := c.Request().Header.Get("X-Request-ID") address := c.Request().Header.Get("X-Address")