From: Michael Tremer Date: Thu, 25 Jan 2024 11:54:00 +0000 (+0000) Subject: web: Fix too generous redirection X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42e745e9900a2d9214e9b7e1664c784aa75a5c0a;p=ipfire.org.git web: Fix too generous redirection The webapp used to redirect people to the front page when it could not find a suitable handler for a URL. Fixes: #13552 Signed-off-by: Michael Tremer --- diff --git a/src/web/__init__.py b/src/web/__init__.py index eb73212c..11b91cc9 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -118,7 +118,7 @@ class Application(tornado.web.Application): (r"/logout", auth.LogoutHandler), ] - self.add_handlers(r"(www\.)?([a-z]+\.dev\.)?ipfire\.org", [ + self.add_handlers(r"www\.([a-z]+\.dev\.)?ipfire\.org", [ # Entry site that lead the user to index (r"/", IndexHandler), @@ -335,7 +335,7 @@ class Application(tornado.web.Application): # location.ipfire.org self.add_handlers(r"location\.([a-z]+\.dev\.)?ipfire\.org", [ - (r"/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/projects/location/{0}" }), + (r"(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/projects/location{0}" }), ]) # geoip.ipfire.org @@ -359,12 +359,12 @@ class Application(tornado.web.Application): # wiki.ipfire.org self.add_handlers(r"wiki\.([a-z]+\.dev\.)?ipfire\.org", [ - (r"/(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/docs/{0}" }), + (r"(.*)", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/docs{0}" }), ]) # ipfire.org - self.add_handlers(r"(.*)ipfire\.org", [ - (r".*", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org" }) + self.add_handlers(r"([a-z]+\.dev\.)?ipfire\.org", [ + (r".*", tornado.web.RedirectHandler, { "url" : "https://www.ipfire.org/" }) ]) logging.info("Successfully initialied application")