From 03937891e2fae759ca3ea37d2080e9e320d7c38d Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Thu, 19 Aug 2021 21:41:20 +0100
Subject: [PATCH] Return nil proxy function if proxy not enabled (#16742)

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 modules/proxy/proxy.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/proxy/proxy.go b/modules/proxy/proxy.go
index 0ab6ed3341..61730544b0 100644
--- a/modules/proxy/proxy.go
+++ b/modules/proxy/proxy.go
@@ -56,7 +56,9 @@ func Match(u string) bool {
 // Proxy returns the system proxy
 func Proxy() func(req *http.Request) (*url.URL, error) {
 	if !setting.Proxy.Enabled {
-		return nil
+		return func(req *http.Request) (*url.URL, error) {
+			return nil, nil
+		}
 	}
 	if setting.Proxy.ProxyURL == "" {
 		return http.ProxyFromEnvironment