From da5d9e8a6aca81fd323109705b274b4911498287 Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Fri, 20 Dec 2024 11:25:01 -0800 Subject: [PATCH] fix HTTP logging so true path is printed --- proxy/proxymanager.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/proxymanager.go b/proxy/proxymanager.go index 05e7c14..161b98d 100644 --- a/proxy/proxymanager.go +++ b/proxy/proxymanager.go @@ -51,16 +51,17 @@ func New(config *Config) *ProxyManager { // Start timer start := time.Now() + // capture these because /upstream/:model rewrites them in c.Next() + clientIP := c.ClientIP() + method := c.Request.Method + path := c.Request.URL.Path + // Process request c.Next() // Stop timer duration := time.Since(start) - // Log request details - clientIP := c.ClientIP() - method := c.Request.Method - path := c.Request.URL.Path statusCode := c.Writer.Status() bodySize := c.Writer.Size()