From f5ddd3c21cc005dd881619bc5080c88e49265e38 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 15 Oct 2025 13:12:28 -0700 Subject: [PATCH] on redirect try to preserve path --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 376e7c8..741431f 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,8 @@ import ( "encoding/json" "flag" "io" + "path" - //"fmt" - "git.openprivacy.ca/openprivacy/log" "io/ioutil" "net/http" "os" @@ -14,6 +13,9 @@ import ( "strings" "sync" "time" + + //"fmt" + "git.openprivacy.ca/openprivacy/log" ) const MaxLength = 8192 @@ -124,8 +126,8 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in blocked, ok := blocklistedIps[ip] blocklistLock.Unlock() if ok && blocked { - log.Debugln("blocked ip, 404ing") - http.Redirect(res, req, "http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", http.StatusSeeOther) + log.Debugln("blocked ip, redirecting to .onion") + http.Redirect(res, req, path.Join("http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", req.URL.Path), http.StatusSeeOther) //res.WriteHeader(http.StatusNotFound) //fmt.Fprint(res, "404 - suspected botnet") return