From d93a6e893881254b5aa7a973b2c12f27ffb9bc64 Mon Sep 17 00:00:00 2001 From: Daniel Levi-Minzi <51272568+dleviminzi@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:18:23 -0500 Subject: [PATCH] Fix: Write response headers from copy of internal response's headers (#797) --- pkg/abstractions/endpoint/buffer.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/abstractions/endpoint/buffer.go b/pkg/abstractions/endpoint/buffer.go index 4a443b8b5..9bb9311ef 100644 --- a/pkg/abstractions/endpoint/buffer.go +++ b/pkg/abstractions/endpoint/buffer.go @@ -468,8 +468,15 @@ func (rb *RequestBuffer) handleHttpRequest(req *request, c container) { defer resp.Body.Close() - // Write response headers + responseHeaders := make(http.Header) for key, values := range resp.Header { + for _, value := range values { + responseHeaders.Add(key, value) + } + } + + // Write response headers + for key, values := range responseHeaders { for _, value := range values { req.ctx.Response().Writer.Header().Add(key, value) }