Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(cors): allow billing idempotency header (#6964)

Multica Eve987ac8ec8bb1
diff --git a/server/cmd/server/cors_headers_test.go b/server/cmd/server/cors_headers_test.go
index 8e8ae51e66..dcc4a647fd 100644
--- a/server/cmd/server/cors_headers_test.go
+++ b/server/cmd/server/cors_headers_test.go
@@ -23,6 +23,15 @@ func TestCORSAllowedHeaders_IncludeClientCapabilities(t *testing.T) {
}
}
+// Workspace subscription checkout and portal requests use Idempotency-Key to
+// make retries safe. Browsers preflight that custom request header, so omitting
+// it from AllowedHeaders prevents the billing request from reaching the server.
+func TestCORSAllowedHeaders_IncludeIdempotencyKey(t *testing.T) {
+ if !slices.Contains(corsAllowedHeaders, "Idempotency-Key") {
+ t.Fatalf("Idempotency-Key missing from CORS allowed headers: %v", corsAllowedHeaders)
+ }
+}
+
// Timeline and comment-list endpoints report defensive hard-cap clamps with
// custom response headers.
// Custom response headers are not readable from browser JS unless the server
diff --git a/server/cmd/server/router.go b/server/cmd/server/router.go
index 317fc2904e..90bc2ae1f0 100644
--- a/server/cmd/server/router.go
+++ b/server/cmd/server/router.go
@@ -59,6 +59,7 @@ var corsAllowedHeaders = []string{
"Accept",
"Authorization",
"Content-Type",
+ "Idempotency-Key",
"X-Workspace-ID",
"X-Workspace-Slug",
"X-Request-ID",