diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go index 7a09cb4..2eab0fe 100644 --- a/webcontroller/web_controller.go +++ b/webcontroller/web_controller.go @@ -221,6 +221,14 @@ func New(r *httprouter.Router, prefix string, conf Config) (wc *WebController) { func middleware(handle httprouter.Handle) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + // Redirect the user to the correct domain + if r.Host == "pixeldrain.net" || r.Host == "pixeldra.in" { + var target = "https://pixeldrain.com" + r.URL.String() + log.Debug("Redirecting user from '%s' to '%s'", r.URL.String(), target) + http.Redirect(w, r, target, http.StatusMovedPermanently) + return + } + w.Header().Set("Strict-Transport-Security", "max-age=31536000") w.Header().Set("X-Clacks-Overhead", "GNU Terry Pratchett") handle(w, r, p)