Skip to content

Commit

Permalink
[ws-proxy] Add /health route (gitpod-io#18915)
Browse files Browse the repository at this point in the history
* [ws-proxy] Add /health route

* retest
  • Loading branch information
easyCZ authored Oct 12, 2023
1 parent d653f98 commit f500e39
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/ws-proxy/pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func (p *WorkspaceProxy) MustServe(ctx context.Context) {
func (p *WorkspaceProxy) Handler() (http.Handler, error) {
r := mux.NewRouter()

r.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})

// install routes
handlerConfig, err := NewRouteHandlerConfig(&p.Config, WithDefaultAuth(p.WorkspaceInfoProvider))
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions components/ws-proxy/pkg/proxy/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ func TestRoutes(t *testing.T) {
Body: "<a href=\"https://ide.test-domain.com/blobserve/gitpod-io/supervisor:latest/__files__/favicon.ico\">See Other</a>.\n\n",
},
},
{
Desc: "/health",
Request: modifyRequest(httptest.NewRequest("GET", "/health", nil),
addHostHeader,
),
Expectation: Expectation{
Status: http.StatusOK,
Header: nil,
Body: "",
},
},
{
Desc: "blobserve IDE unauthorized GET /",
Config: &config,
Expand Down

0 comments on commit f500e39

Please sign in to comment.