From 048d3b1963fa7aeb68a59bf8d0dc0417963ca28f Mon Sep 17 00:00:00 2001 From: Knative Prow Robot Date: Mon, 29 Jan 2024 09:17:27 +0000 Subject: [PATCH] [release-1.12] Fix mtbroker-filter to proxy response headers (#7632) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix mtbroker-filter to proxy response headers * Switch to utils.PassThroughHeaders --------- Co-authored-by: Christoph Stäbler --- pkg/broker/filter/filter_handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/broker/filter/filter_handler.go b/pkg/broker/filter/filter_handler.go index b692811a11c..0c846abb40b 100644 --- a/pkg/broker/filter/filter_handler.go +++ b/pkg/broker/filter/filter_handler.go @@ -308,7 +308,8 @@ func (h *Handler) writeResponse(ctx context.Context, writer http.ResponseWriter, writer.WriteHeader(http.StatusBadGateway) return http.StatusBadGateway, errors.New("received a non-empty response not recognized as CloudEvent. The response MUST be either empty or a valid CloudEvent") } - writeHeaders(dispatchInfo.ResponseHeader, writer) // Proxy original Response Headers for downstream use + + writeHeaders(utils.PassThroughHeaders(dispatchInfo.ResponseHeader), writer) // Proxy original Response Headers for downstream use h.logger.Debug("Response doesn't contain a CloudEvent, replying with an empty response", zap.Any("target", target)) writer.WriteHeader(dispatchInfo.ResponseCode) return dispatchInfo.ResponseCode, nil @@ -333,7 +334,7 @@ func (h *Handler) writeResponse(ctx context.Context, writer http.ResponseWriter, defer eventResponse.Finish(nil) // Proxy the original Response Headers for downstream use - writeHeaders(dispatchInfo.ResponseHeader, writer) + writeHeaders(utils.PassThroughHeaders(dispatchInfo.ResponseHeader), writer) if err := cehttp.WriteResponseWriter(ctx, eventResponse, dispatchInfo.ResponseCode, writer); err != nil { return http.StatusInternalServerError, fmt.Errorf("failed to write response event: %w", err)