Disable redirects to pixeldrain.com
This commit is contained in:
@@ -211,13 +211,12 @@ func New(r *httprouter.Router, prefix string, conf Config) (wc *WebController) {
|
|||||||
func middleware(handle httprouter.Handle) httprouter.Handle {
|
func middleware(handle httprouter.Handle) httprouter.Handle {
|
||||||
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
// Redirect the user to the correct domain
|
// Redirect the user to the correct domain
|
||||||
switch r.Host {
|
if strings.HasPrefix(r.Host, "www.") {
|
||||||
case "www.pixeldrain.com",
|
http.Redirect(
|
||||||
"pixeldrain.net", "www.pixeldrain.net",
|
w, r,
|
||||||
"pixeldra.in", "www.pixeldra.in":
|
"https://"+strings.TrimPrefix(r.Host, "www.")+r.URL.String(),
|
||||||
var target = "https://pixeldrain.com" + r.URL.String()
|
http.StatusMovedPermanently,
|
||||||
log.Debug("Redirecting user from '%s' to '%s'", r.URL.String(), target)
|
)
|
||||||
http.Redirect(w, r, target, http.StatusMovedPermanently)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user