diff --git a/backend/sophon/notebooks/apache.py b/backend/sophon/notebooks/apache.py index b01b37d..5488728 100644 --- a/backend/sophon/notebooks/apache.py +++ b/backend/sophon/notebooks/apache.py @@ -5,7 +5,6 @@ import pathlib import socket import typing as t -import lazy_object_proxy from django.conf import settings log = logging.getLogger(__name__) @@ -52,7 +51,7 @@ class ApacheDB: del adb[key] -db: ApacheDB = lazy_object_proxy.Proxy(lambda: ApacheDB(settings.PROXY_FILE)) +db: ApacheDB = ApacheDB(settings.PROXY_FILE) def get_ephemeral_port() -> int: diff --git a/backend/sophon/notebooks/models.py b/backend/sophon/notebooks/models.py index 7c93b57..61b89be 100644 --- a/backend/sophon/notebooks/models.py +++ b/backend/sophon/notebooks/models.py @@ -356,7 +356,7 @@ class Notebook(SophonGroupModel): network.connect(proxy) self.log.debug("Setting internal_url...") - self.internal_url = f"http://{self.container_name}:8888" + self.internal_url = f"{self.container_name}:8888" self.log.debug("Adding entry to the apache_db...") apache_db[bytes(self.external_domain, encoding="ascii")] = bytes(self.internal_url, encoding="ascii") diff --git a/proxy/httpd.conf b/proxy/httpd.conf index efb475e..3efca55 100644 --- a/proxy/httpd.conf +++ b/proxy/httpd.conf @@ -554,6 +554,7 @@ SSLRandomSeed connect builtin # --- DARK SORCERY AHEAD --- # Regexes used as string comparisions lie beyond this line. +LogLevel rewrite:trace6 # Enable rewriting (proxying) RewriteEngine on @@ -591,5 +592,4 @@ RewriteRule "/(.*)" "ws://${sophonproxy:%{HTTP_HOST}}/$1" [P,L,E=matched:1] # R # *.sophon.steffo.eu → notebook RewriteCond "%{ENV:matched}" "! -eq 1" [NC] # If the url hasn't been matched by the previous rules RewriteCond ".%{ENV:APACHE_PROXY_BASE_DOMAIN} %{HTTP_HOST}" "^([^ ]+) [^ ]+\1$" [NC] # If this is any other subdomain of ENV:APACHE_PROXY_BASE_DOMAIN -RewriteCond "%{HTTP_HOST}" ".%{ENV:APACHE_PROXY_BASE_DOMAIN}$" [NC] RewriteRule "/(.*)" "http://${sophonproxy:%{HTTP_HOST}}/$1" [P,L,E=matched:1]