mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-14 00:49:19 +02:00
Updates 2.6.3
+ Added X-Forwarded-Proto for automatic proxy detector + Split blacklist and whitelist from geodb script file + Optimized compile binary size + Added access control to TCP proxy + Added "invalid config detect" in up time monitor for isse #7 + Fixed minor bugs in advance stats panel + Reduced file size of embedded materials
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"imuslab.com/zoraxy/mod/utils"
|
||||
@@ -220,7 +221,24 @@ func getWebsiteStatusWithLatency(url string) (bool, int64, int) {
|
||||
func getWebsiteStatus(url string) (int, error) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
//Try replace the http with https and vise versa
|
||||
rewriteURL := ""
|
||||
if strings.Contains(url, "https://") {
|
||||
rewriteURL = strings.ReplaceAll(url, "https://", "http://")
|
||||
} else if strings.Contains(url, "http://") {
|
||||
rewriteURL = strings.ReplaceAll(url, "http://", "https://")
|
||||
}
|
||||
|
||||
resp, err = http.Get(rewriteURL)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "http: server gave HTTP response to HTTPS client") {
|
||||
//Invalid downstream reverse proxy settings, but it is online
|
||||
//return SSL handshake failed
|
||||
return 525, nil
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
|
||||
}
|
||||
status_code := resp.StatusCode
|
||||
resp.Body.Close()
|
||||
|
Reference in New Issue
Block a user