feat(handler): 404 on host not found
This commit is contained in:
@@ -112,7 +112,7 @@ curl -X DELETE \
|
|||||||
- [x] docker compose example + .env
|
- [x] docker compose example + .env
|
||||||
- [ ] proper doc
|
- [ ] proper doc
|
||||||
- [ ] unit tests
|
- [ ] unit tests
|
||||||
- [ ] 404 GET on host not found
|
- [x] 404 GET on host not found
|
||||||
- [ ] 403 PUT on host already taken
|
- [ ] 403 PUT on host already taken
|
||||||
- [ ] X-Redirect
|
- [ ] X-Redirect
|
||||||
- [ ] X-Proxy
|
- [ ] X-Proxy
|
||||||
|
|||||||
+3
-1
@@ -237,8 +237,10 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler, _BaseHandler):
|
|||||||
def translate_path(self, path: str) -> str:
|
def translate_path(self, path: str) -> str:
|
||||||
if path.startswith(self.CERTBOT_CHALLENGE_PATH):
|
if path.startswith(self.CERTBOT_CHALLENGE_PATH):
|
||||||
return self.certbot_www + 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
|
path = f"/{page.path}" + path
|
||||||
|
elif host != self.default_host:
|
||||||
|
return ""
|
||||||
elif (
|
elif (
|
||||||
path not in self.AUTHORIZED_PATHS and self.__get_subpath(path) is None
|
path not in self.AUTHORIZED_PATHS and self.__get_subpath(path) is None
|
||||||
): # not a valid path
|
): # not a valid path
|
||||||
|
|||||||
Reference in New Issue
Block a user