From f7f6b15ef1acd033f6d2f7a2ed383ede782ea202 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Sat, 2 Jun 2018 10:24:00 +0000 Subject: [PATCH] Fix 403 error when listening on 127.0.0.1:80. --- src/Ui/UiServer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Ui/UiServer.py b/src/Ui/UiServer.py index 6f7889f1..e13cdd1f 100644 --- a/src/Ui/UiServer.py +++ b/src/Ui/UiServer.py @@ -63,6 +63,14 @@ class UiServer: self.learn_allowed_host = False elif config.ui_ip == "127.0.0.1": self.allowed_hosts = set(["zero", "localhost:%s" % config.ui_port, "127.0.0.1:%s" % config.ui_port]) + # "URI producers and normalizers should omit the port component and + # its ':' delimiter if port is empty or if its value would be the + # same as that of the scheme's default." + # Source: https://tools.ietf.org/html/rfc3986#section-3.2.3 + # As a result, we need to support portless hosts if port 80 is in + # use. + if config.ui_port == 80: + self.allowed_hosts.update(["localhost", "127.0.0.1"]) self.learn_allowed_host = False else: self.allowed_hosts = set([])