diff --git a/Caddyfile.standalone b/Caddyfile.standalone index 3160818c..0f2ac259 100644 --- a/Caddyfile.standalone +++ b/Caddyfile.standalone @@ -16,12 +16,16 @@ https://:8919 { tls internal { on_demand } - reverse_proxy localhost:8917 + + reverse_proxy localhost:8917 { + header_up X-Forwarded-For {remote_host} + header_up X-Forwarded-Proto https + header_up X-Forwarded-Host {host} + } header { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" X-XSS-Protection "1; mode=block" - X-Content-Type-Options "nosniff" X-Frame-Options "SAMEORIGIN" Referrer-Policy "strict-origin-when-cross-origin" } @@ -32,7 +36,12 @@ https://:8918 { tls internal { on_demand } - reverse_proxy localhost:8916 + + reverse_proxy localhost:8916 { + header_up X-Forwarded-For {remote_host} + header_up X-Forwarded-Proto https + header_up X-Forwarded-Host {host} + } header { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" diff --git a/start_servers.py b/start_servers.py index 5140e776..92c51ae7 100755 --- a/start_servers.py +++ b/start_servers.py @@ -177,6 +177,14 @@ class StandaloneServerManager: if result.returncode != 0: self.error(f"Frontend build failed with exit code {result.returncode}") + # Copy static files to standalone directory (required for Next.js standalone mode) + static_src = frontend_dir / ".next" / "static" + static_dst = frontend_dir / ".next" / "standalone" / ".next" / "static" + if static_src.exists() and not static_dst.exists(): + self.log("Copying static files to standalone build...") + import shutil + shutil.copytree(static_src, static_dst) + def start_backend(self): """Start FastAPI backend server""" self.log(f"Starting backend on port {self.backend_port}...")