mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
feat: add validation for localhost routes to prevent usage of godoxy port causing self recursion
This commit is contained in:
@@ -3,6 +3,7 @@ package middleware
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/common"
|
||||
@@ -38,8 +39,8 @@ func (m *redirectHTTP) before(w http.ResponseWriter, r *http.Request) (proceed b
|
||||
host = r.Host
|
||||
}
|
||||
|
||||
if common.ProxyHTTPSPort != "443" {
|
||||
r.URL.Host = host + ":" + common.ProxyHTTPSPort
|
||||
if common.ProxyHTTPSPort != 443 {
|
||||
r.URL.Host = host + ":" + strconv.Itoa(common.ProxyHTTPSPort)
|
||||
} else {
|
||||
r.URL.Host = host
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user