From 7ac4ba5368774549cc0f16ef67de09376c2bb60d Mon Sep 17 00:00:00 2001 From: "Shen, Tianxiang" Date: Thu, 29 Aug 2024 16:27:59 -0700 Subject: [PATCH] fix the panic error in dashboard proxy --- pkg/utils/proxy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/utils/proxy.go b/pkg/utils/proxy.go index 39c427d8f..1ebcf8698 100644 --- a/pkg/utils/proxy.go +++ b/pkg/utils/proxy.go @@ -44,7 +44,11 @@ func Proxy(request *http.Request, response http.ResponseWriter, url string, clie if err != nil { logging.Log.Errorf("Failed to execute request: %s", err) - return resp.StatusCode, err + if resp != nil { + return resp.StatusCode, err + } + // Return a generic status code if resp is nil + return http.StatusInternalServerError, err } for name, values := range resp.Header {