From 9799ea410cfe6c21d0f6b978ba50c8eeecac95a6 Mon Sep 17 00:00:00 2001 From: Josh Siviour Date: Fri, 28 Aug 2026 10:47:40 +1000 Subject: [PATCH] fix: preserve escaped path through the console proxy for SigV4 (#931) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The spinifex-ui reverse proxy copied only the decoded URL path and dropped RawPath, so a percent-encoded path segment (a ':' in a bedrock modelId) was re-encoded before reaching the gateway. The gateway then canonicalised a different path than the one the browser SDK signed, and SigV4 rejected the request with a signature mismatch — surfacing as an unparseable '") } +func TestWriteThrottleError_Bedrock(t *testing.T) { + gw := &GatewayConfig{DisableLogging: true} + + req := httptest.NewRequest(http.MethodPost, "/model/meta.llama3-2-1b-instruct-v1%3A0/converse", nil) + req = req.WithContext(context.WithValue(req.Context(), ctxService, "bedrock")) + w := httptest.NewRecorder() + + gw.writeThrottleError(w, req) + + resp := w.Result() + body, _ := io.ReadAll(resp.Body) + assert.Equal(t, eksJSONContentType, resp.Header.Get("Content-Type"), "bedrock must get JSON, not XML") + assert.Contains(t, string(body), `"__type"`) + assert.NotContains(t, string(body), "