diff --git a/coderd/coderd.go b/coderd/coderd.go
index ad52edc401cce..d81373638cd2d 100644
--- a/coderd/coderd.go
+++ b/coderd/coderd.go
@@ -233,6 +233,8 @@ func New(options *Options) *API {
httpmw.CSRF(options.SecureAuthCookie),
)
+ r.Get("/healthz", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("OK")) })
+
apps := func(r chi.Router) {
r.Use(
tracing.Middleware(api.TracerProvider),
diff --git a/coderd/coderd_test.go b/coderd/coderd_test.go
index 9fc459fc9e18e..29e6914987f8f 100644
--- a/coderd/coderd_test.go
+++ b/coderd/coderd_test.go
@@ -2,6 +2,7 @@ package coderd_test
import (
"context"
+ "io"
"net/http"
"net/netip"
"strconv"
@@ -114,3 +115,17 @@ func TestDERPLatencyCheck(t *testing.T) {
defer res.Body.Close()
require.Equal(t, http.StatusOK, res.StatusCode)
}
+func TestHealthz(t *testing.T) {
+ t.Parallel()
+ client := coderdtest.New(t, nil)
+
+ res, err := client.Request(context.Background(), http.MethodGet, "/healthz", nil)
+ require.NoError(t, err)
+ defer res.Body.Close()
+
+ require.Equal(t, http.StatusOK, res.StatusCode)
+ body, err := io.ReadAll(res.Body)
+ require.NoError(t, err)
+
+ assert.Equal(t, "OK", string(body))
+}
diff --git a/coderd/coderdtest/authorize.go b/coderd/coderdtest/authorize.go
index 516b96809a049..e54b3104623ba 100644
--- a/coderd/coderdtest/authorize.go
+++ b/coderd/coderdtest/authorize.go
@@ -37,6 +37,7 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
assertRoute := map[string]RouteCheck{
// These endpoints do not require auth
+ "GET:/healthz": {NoAuthorize: true},
"GET:/api/v2": {NoAuthorize: true},
"GET:/api/v2/buildinfo": {NoAuthorize: true},
"GET:/api/v2/users/first": {NoAuthorize: true},
diff --git a/site/e2e/pom/HealthzPage.ts b/site/e2e/pom/HealthzPage.ts
deleted file mode 100644
index 7a85ec38fb07b..0000000000000
--- a/site/e2e/pom/HealthzPage.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Locator, Page } from "@playwright/test"
-import { BasePom } from "./BasePom"
-
-export class HealthzPage extends BasePom {
- constructor(baseURL: string | undefined, page: Page) {
- super(baseURL, "/healthz", page)
- }
-
- getOk(): Locator {
- const locator = this.page.locator("text=ok")
- return locator
- }
-}
diff --git a/site/e2e/tests/healthz.spec.ts b/site/e2e/tests/healthz.spec.ts
deleted file mode 100644
index 8a3c29da65954..0000000000000
--- a/site/e2e/tests/healthz.spec.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { test } from "@playwright/test"
-import { HealthzPage } from "../pom/HealthzPage"
-
-test("Healthz is available without authentication", async ({
- baseURL,
- page,
-}) => {
- const healthzPage = new HealthzPage(baseURL, page)
- await page.goto(healthzPage.url, { waitUntil: "networkidle" })
- await healthzPage.getOk().waitFor({ state: "visible" })
-})
diff --git a/site/src/AppRouter.tsx b/site/src/AppRouter.tsx
index ca9191030c545..11437b855090b 100644
--- a/site/src/AppRouter.tsx
+++ b/site/src/AppRouter.tsx
@@ -30,7 +30,6 @@ const NotFoundPage = lazy(() => import("./pages/404Page/404Page"))
const CliAuthenticationPage = lazy(
() => import("./pages/CliAuthPage/CliAuthPage"),
)
-const HealthzPage = lazy(() => import("./pages/HealthzPage/HealthzPage"))
const AccountPage = lazy(
() => import("./pages/UserSettingsPage/AccountPage/AccountPage"),
)
@@ -107,7 +106,6 @@ export const AppRouter: FC = () => {
} />
} />
- } />
ok
-
-export default HealthzPage