Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
4fcf0b15a2
1 changed files with 6 additions and 5 deletions
  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) {