on redirect try to preserve path
This commit is contained in:
parent
4386c07113
commit
f5ddd3c21c
10
main.go
10
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
|
||||
|
|
Loading…
Reference in New Issue