From f3b5894e0e247939d7a0fc7907075283c2bd9443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Thu, 27 Nov 2025 15:35:07 +0100 Subject: [PATCH] Fix mixed content error for audio files behind HTTPS proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add root_path setting to configure Gradio for HTTPS reverse proxy. Set AUDIOCRAFT_ROOT_PATH env var to external URL (e.g., https://example.com). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- config/settings.py | 1 + main.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/settings.py b/config/settings.py index 2ebc8b8..545cb78 100644 --- a/config/settings.py +++ b/config/settings.py @@ -26,6 +26,7 @@ class Settings(BaseSettings): host: str = Field(default="0.0.0.0", description="Server bind host") gradio_port: int = Field(default=7860, description="Gradio UI port") api_port: int = Field(default=8000, description="FastAPI port") + root_path: Optional[str] = Field(default=None, description="External URL for reverse proxy (e.g., https://example.com)") # Paths data_dir: Path = Field(default=Path("./data"), description="Data directory") diff --git a/main.py b/main.py index d412677..333819d 100644 --- a/main.py +++ b/main.py @@ -152,12 +152,17 @@ def main(): try: # Gradio 6.x: show_api replaced with footer_links footer = ["api", "gradio"] if settings.api_enabled else ["gradio"] - app.launch( - server_name=settings.host, - server_port=settings.gradio_port, - share=False, - footer_links=footer, - ) + launch_kwargs = { + "server_name": settings.host, + "server_port": settings.gradio_port, + "share": False, + "footer_links": footer, + } + # Add root_path for HTTPS reverse proxy support + if settings.root_path: + launch_kwargs["root_path"] = settings.root_path + logger.info(f"Using root_path: {settings.root_path}") + app.launch(**launch_kwargs) except KeyboardInterrupt: logger.info("Shutting down...") finally: