Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/server/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ func staticDirFromEnv() string {
}

// isStaticPath returns true if the path should be handled by the static file
// server rather than the API. API paths start with /api/ or are /health.
// server rather than the API. API paths start with /api/ or are /health or
// /version. /version is a public root-path endpoint (build metadata, no auth)
// registered in the API router table; it must not fall through to the SPA
// fallback on the Lambda path, matching the explicit mux.HandleFunc("/version")
// registration used on the HTTP/Cloud Run path in internal/server/http.go.
// OIDC discovery paths (/.well-known/*) are intercepted earlier by the
// transport layer via api.IsOIDCDiscoveryPath, so they never reach here.
func isStaticPath(urlPath string) bool {
Expand All @@ -183,6 +187,9 @@ func isStaticPath(urlPath string) bool {
if clean == "/health" {
return false
}
if clean == "/version" {
return false
}
return true
}

Expand Down
2 changes: 2 additions & 0 deletions internal/server/static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func TestIsStaticPath(t *testing.T) {
{"/app/dashboard", true},
{"//health", false}, // double-slash normalised to /health
{"//api/test", false},
{"/version", false}, // public build-metadata endpoint must reach API, not SPA
{"//version", false}, // double-slash normalised to /version
}
for _, tt := range tests {
t.Run(tt.path, func(t *testing.T) {
Expand Down
Loading