From 854e00882b45ee1bc69931c944df28493fcbddbc Mon Sep 17 00:00:00 2001 From: edraft Date: Sat, 11 Jan 2025 01:31:26 +0100 Subject: [PATCH] Redirector handle by request url --- api/src/redirector.py | 7 ++++++- version.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/redirector.py b/api/src/redirector.py index 1f81f54..66beee2 100644 --- a/api/src/redirector.py +++ b/api/src/redirector.py @@ -36,7 +36,12 @@ async def _handle_request(path: str): domains = Environment.get("DOMAINS", list[str], []) domain = await short_url.domain - if domain is not None and domain.name not in domains: + logger.debug(f"Domain: {domain}, request.host: {request.host}") + + host = request.host + if ":" in host: + host = host.split(":")[0] + if host not in domains or domain is not None and domain.name not in domains: return render_template("404.html"), 404 user_agent = request.headers.get("User-Agent", "").lower() diff --git a/version.txt b/version.txt index cb174d5..d2d61a7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.1 \ No newline at end of file +1.2.2 \ No newline at end of file