Sfoglia il codice sorgente

auto update script executed

Toby Chui 1 anno fa
parent
commit
4fcf0b15a2
1 ha cambiato i file con 6 aggiunte e 5 eliminazioni
  1. 6 5
      mod/dynamicproxy/proxyRequestHandler.go

+ 6 - 5
mod/dynamicproxy/proxyRequestHandler.go

@@ -45,11 +45,12 @@ func (router *Router) getSubdomainProxyEndpointFromHostname(hostname string) *Su
 }
 
 func (router *Router) rewriteURL(rooturl string, requestURL string) string {
-	if strings.HasPrefix(requestURL, rooturl) {
-		newURL := strings.TrimPrefix(requestURL, rooturl)
-		return newURL
-	}
-	return ""
+	rewrittenURL := ""
+	rewrittenURL = strings.TrimPrefix(requestURL, rooturl)
+	rewrittenURL = strings.TrimPrefix(requestURL, "http://"+rooturl)
+	rewrittenURL = strings.TrimPrefix(requestURL, "https://"+rooturl)
+
+	return rewrittenURL
 }
 
 func (h *ProxyHandler) subdomainRequest(w http.ResponseWriter, r *http.Request, target *SubdomainEndpoint) {