1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-10-16 07:07:26 +00:00

💥 Everything works!

This commit is contained in:
Steffo 2021-10-19 22:40:00 +02:00
parent d85f57e04a
commit 94e501b8f2
3 changed files with 3 additions and 4 deletions

View file

@ -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:

View file

@ -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")

View file

@ -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]