From a3d46d7597e31d491ea70e2a76152177613507ec Mon Sep 17 00:00:00 2001 From: Mathieu Fenniak Date: Tue, 7 Oct 2025 08:12:16 +0000 Subject: [PATCH] chore: add additional logging to cacheproxy (#1065) In support of diagnosing #1064, I hope. - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/1065): chore: add additional logging to cacheproxy Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1065 Reviewed-by: earl-warren Co-authored-by: Mathieu Fenniak Co-committed-by: Mathieu Fenniak --- act/cacheproxy/handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/act/cacheproxy/handler.go b/act/cacheproxy/handler.go index e494b9c5..499c5167 100644 --- a/act/cacheproxy/handler.go +++ b/act/cacheproxy/handler.go @@ -64,7 +64,7 @@ func StartHandler(targetHost, outboundIP string, port uint16, cacheProxyHostOver discard.Out = io.Discard logger = discard } - logger = logger.WithField("module", "artifactcache") + logger = logger.WithField("module", "cacheproxy") h.logger = logger h.cacheSecret = cacheSecret @@ -139,6 +139,7 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er r.SetURL(targetURL) r.Out.URL.Path = uri + h.logger.Debugf("proxy req %s %q to %q", r.In.Method, r.In.URL, r.Out.URL) r.Out.Header.Set("Forgejo-Cache-Repo", runData.RepositoryFullName) r.Out.Header.Set("Forgejo-Cache-RunNumber", runData.RunNumber) @@ -150,6 +151,10 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er r.Out.Header.Set("Forgejo-Cache-WriteIsolationKey", runData.WriteIsolationKey) } }, + ModifyResponse: func(r *http.Response) error { + h.logger.Debugf("proxy resp %s w/ %d bytes", r.Status, r.ContentLength) + return nil + }, } return proxy, nil }