Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
25de4cef76
2 changed files with 5 additions and 5 deletions
  1. 2 0
      mod/dynamicproxy/Server.go
  2. 3 5
      mod/dynamicproxy/dpcore/dpcore.go

+ 2 - 0
mod/dynamicproxy/Server.go

@@ -1,6 +1,7 @@
 package dynamicproxy
 
 import (
+	"fmt"
 	"net/http"
 	"os"
 	"strings"
@@ -74,6 +75,7 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 
 		if potentialProxtEndpoint != nil {
 			//Missing tailing slash. Redirect to target proxy endpoint
+			fmt.Println("Missing back slash. Redirecting to " + r.RequestURI + "/")
 			http.Redirect(w, r, r.RequestURI+"/", http.StatusTemporaryRedirect)
 			//h.proxyRequest(w, r, potentialProxtEndpoint)
 		} else {

+ 3 - 5
mod/dynamicproxy/dpcore/dpcore.go

@@ -294,21 +294,19 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
 		}
 	}
 
-	fmt.Println("CHECKPOINT1", req.URL)
 	p.Director(outreq)
 	outreq.Close = false
 	outreq.Host = rrr.OriginalHost
-	fmt.Println("CHECKPOINT2", req.URL)
+
 	// We may modify the header (shallow copied above), so we only copy it.
 	outreq.Header = make(http.Header)
 	copyHeader(outreq.Header, req.Header)
-	fmt.Println("CHECKPOINT3", req.URL)
+
 	// Remove hop-by-hop headers listed in the "Connection" header, Remove hop-by-hop headers.
 	removeHeaders(outreq.Header)
-	fmt.Println("CHECKPOINT4", req.URL)
+
 	// Add X-Forwarded-For Header.
 	addXForwardedForHeader(outreq)
-	fmt.Println("CHECKPOINT5", req.URL)
 
 	res, err := transport.RoundTrip(outreq)
 	if err != nil {