Fix mixed content error for audio files behind HTTPS proxy
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
17
main.py
17
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:
|
||||
|
||||
Reference in New Issue
Block a user