diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py index 9508591a4..0015f46ea 100644 --- a/mitmproxy/tools/web/app.py +++ b/mitmproxy/tools/web/app.py @@ -708,15 +708,6 @@ class SaveOptions(RequestHandler): pass -class DnsRebind(RequestHandler): - def get(self): - raise tornado.web.HTTPError( - 403, - reason="To protect against DNS rebinding, mitmweb can only be accessed by IP at the moment. " - "(https://github.com/mitmproxy/mitmproxy/issues/3234)", - ) - - class State(RequestHandler): # Separate method for testability. @staticmethod @@ -815,7 +806,7 @@ class Application(tornado.web.Application): self.master = master auth_addon: WebAuth = master.addons.get("webauth") super().__init__( - default_host="dns-rebind-protection", + handlers=handlers, # type: ignore # https://github.com/tornadoweb/tornado/pull/3455 template_path=os.path.join(os.path.dirname(__file__), "templates"), static_path=os.path.join(os.path.dirname(__file__), "static"), xsrf_cookies=True, @@ -826,10 +817,3 @@ class Application(tornado.web.Application): transforms=[GZipContentAndFlowFiles], is_valid_password=auth_addon.is_valid_password, ) - - self.add_handlers("dns-rebind-protection", [(r"/.*", DnsRebind)]) - self.add_handlers( - # make mitmweb accessible by IP only to prevent DNS rebinding. - r"^(localhost|[0-9.]+|\[[0-9a-fA-F:]+\])$", - handlers, # type: ignore # https://github.com/tornadoweb/tornado/pull/3455 - )