更新 proxy/handler.go

This commit is contained in:
XOF
2025-12-15 05:53:34 +08:00
parent 31cd013a11
commit e3b6c775b2

View File

@@ -68,6 +68,13 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var targetURL string var targetURL string
if strings.HasPrefix(targetPath, "http:/") && !strings.HasPrefix(targetPath, "http://") {
targetPath = strings.Replace(targetPath, "http:/", "http://", 1)
}
if strings.HasPrefix(targetPath, "https:/") && !strings.HasPrefix(targetPath, "https://") {
targetPath = strings.Replace(targetPath, "https:/", "https://", 1)
}
if strings.HasPrefix(targetPath, "http://") || strings.HasPrefix(targetPath, "https://") { if strings.HasPrefix(targetPath, "http://") || strings.HasPrefix(targetPath, "https://") {
targetURL = targetPath targetURL = targetPath
} else { } else {