Update proxy hook
This commit is contained in:
parent
a69062d2e8
commit
7244b53622
@ -3,11 +3,14 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"github.com/TicketsBot/GoPanel/config"
|
"github.com/TicketsBot/GoPanel/config"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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 !strings.HasPrefix(req.Header.Get("Authorization"), "Basic") {
|
||||||
req.URL.Scheme = "http"
|
req.URL.Scheme = "http"
|
||||||
req.URL.Host = config.Conf.Bot.ProxyUrl
|
req.URL.Host = config.Conf.Bot.ProxyUrl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user