From 7244b536221bb7fcdd866dfc69ec5ef1924bf543 Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:08:38 +0000 Subject: [PATCH] Update proxy hook --- utils/proxyhook.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/proxyhook.go b/utils/proxyhook.go index ddc2706..5b1dcdd 100644 --- a/utils/proxyhook.go +++ b/utils/proxyhook.go @@ -3,11 +3,14 @@ package utils import ( "github.com/TicketsBot/GoPanel/config" "net/http" + "strings" ) // Twilight's HTTP proxy doesn't support the typical HTTP proxy protocol - instead you send the request directly // to the proxy's host in the URL. This is not how Go's proxy function should be used, but it works :) func ProxyHook(token string, req *http.Request) { - req.URL.Scheme = "http" - req.URL.Host = config.Conf.Bot.ProxyUrl + if !strings.HasPrefix(req.Header.Get("Authorization"), "Basic") { + req.URL.Scheme = "http" + req.URL.Host = config.Conf.Bot.ProxyUrl + } }