]> git.ipfire.org Git - ipfire.org.git/commitdiff
web: Fix too generous redirection
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Jan 2024 11:54:00 +0000 (11:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Jan 2024 11:54:00 +0000 (11:54 +0000)
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 <michael.tremer@ipfire.org>
src/web/__init__.py

index eb73212c682ecc96ad85217a8be915a09512301f..11b91cc96f71917daff51257c0ce1fae4512f1af 100644 (file)
@@ -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")