feat(handler): 404 on host not found

This commit is contained in:
2026-04-18 16:21:44 +02:00
parent 32b4d9385c
commit 5ffc81b6ca
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ curl -X DELETE \
- [x] docker compose example + .env
- [ ] proper doc
- [ ] unit tests
- [ ] 404 GET on host not found
- [x] 404 GET on host not found
- [ ] 403 PUT on host already taken
- [ ] X-Redirect
- [ ] X-Proxy
+3 -1
View File
@@ -237,8 +237,10 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler, _BaseHandler):
def translate_path(self, path: str) -> str:
if path.startswith(self.CERTBOT_CHALLENGE_PATH):
return self.certbot_www + path
if (page := self.registry.get_from_host(self._get_host())) is not None:
if (page := self.registry.get_from_host(host := self._get_host())) is not None:
path = f"/{page.path}" + path
elif host != self.default_host:
return ""
elif (
path not in self.AUTHORIZED_PATHS and self.__get_subpath(path) is None
): # not a valid path