diff --git a/api/src/redirector.py b/api/src/redirector.py index 79b1e09..286cdd2 100644 --- a/api/src/redirector.py +++ b/api/src/redirector.py @@ -36,12 +36,14 @@ async def _handle_request(path: str): domains = Environment.get("DOMAINS", list[str], []) domain = await short_url.domain - logger.debug(f"Domain: {domain.name}, request.host: {request.host}") + logger.debug(f"Domain: {domain.name if domain is not None else None}, request.host: {request.host}") host = request.host if ":" in host: host = host.split(":")[0] - if domain is None or domain.name not in domains and not host.endswith(domain.name): + + domain_strict_mode = Environment.get("DOMAIN_STRICT_MODE", bool, False) + if domain is None or domain.name not in domains or (domain_strict_mode and not host.endswith(domain.name)): return render_template("404.html"), 404 user_agent = request.headers.get("User-Agent", "").lower() diff --git a/version.txt b/version.txt index b966e81..3a1f10e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.4 \ No newline at end of file +1.2.5 \ No newline at end of file