Proxy whitelabel / bearer requests

This commit is contained in:
rxdn 2023-09-10 17:51:17 +01:00
parent 5e2b3ad4fc
commit d1997e1e2a

View File

@ -3,14 +3,11 @@ package utils
import ( import (
"github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/config"
"net/http" "net/http"
"os"
) )
// Twilight's HTTP proxy doesn't support the typical HTTP proxy protocol - instead you send the request directly // 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 :) // 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) { func ProxyHook(token string, req *http.Request) {
if token == os.Getenv("WORKER_PUBLIC_TOKEN") { req.URL.Scheme = "http"
req.URL.Scheme = "http" req.URL.Host = config.Conf.Bot.ProxyUrl
req.URL.Host = config.Conf.Bot.ProxyUrl
}
} }