From 5d9d9f784aaf7caa21862379e93c60d39f8dc1ad Mon Sep 17 00:00:00 2001 From: Adriankf59 Date: Sun, 26 Apr 2026 18:15:38 +0700 Subject: [PATCH] updated --- src/ocr_sprint/config.py | 1 + src/ocr_sprint/main.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/ocr_sprint/config.py b/src/ocr_sprint/config.py index 73f8c8f..71738b1 100644 --- a/src/ocr_sprint/config.py +++ b/src/ocr_sprint/config.py @@ -24,6 +24,7 @@ class Settings(BaseSettings): app_host: str = "0.0.0.0" app_port: int = 8000 app_log_level: str = "INFO" + root_path: str = "" # For reverse proxy with path prefix (e.g., "/ocr") # Storage (Phase 1: local fs) storage_local_dir: Path = Path("./storage") diff --git a/src/ocr_sprint/main.py b/src/ocr_sprint/main.py index 7218b62..9005ae9 100644 --- a/src/ocr_sprint/main.py +++ b/src/ocr_sprint/main.py @@ -30,6 +30,9 @@ def create_app() -> FastAPI: configure_logging(settings.app_log_level) _ensure_schema() + # Support for reverse proxy with path prefix (e.g., /ocr) + root_path = getattr(settings, "root_path", "") + app = FastAPI( title="OCR Sprint Service", version=__version__, @@ -37,6 +40,7 @@ def create_app() -> FastAPI: docs_url="/docs", redoc_url="/redoc", openapi_url="/openapi.json", + root_path=root_path, ) register_error_handlers(app)