diff --git a/app/ui.py b/app/ui.py index 120c52f..9993ddb 100644 --- a/app/ui.py +++ b/app/ui.py @@ -712,17 +712,18 @@ def object_presign(bucket_name: str, object_key: str): except IamError as exc: return jsonify({"error": str(exc)}), 403 - api_base = current_app.config.get("API_BASE_URL") - if not api_base: - api_base = "http://127.0.0.1:5000" - api_base = api_base.rstrip("/") - - url = f"{api_base}/presign/{bucket_name}/{object_key}" + # Use internal URL for the connection to ensure reliability + # We ignore API_BASE_URL here because that might be set to a public domain + # which is not reachable from within the container (NAT/DNS issues). + connection_url = "http://127.0.0.1:5000" + url = f"{connection_url}/presign/{bucket_name}/{object_key}" headers = _api_headers() # Forward the host so the API knows the public URL + # We also add X-Forwarded-For to ensure ProxyFix middleware processes the headers headers["X-Forwarded-Host"] = request.host headers["X-Forwarded-Proto"] = request.scheme + headers["X-Forwarded-For"] = request.remote_addr or "127.0.0.1" try: response = requests.post(url, headers=headers, json=payload, timeout=5) diff --git a/templates/docs.html b/templates/docs.html index 6f0dd40..ea559c2 100644 --- a/templates/docs.html +++ b/templates/docs.html @@ -31,14 +31,61 @@ . .venv/Scripts/activate # PowerShell: .\\.venv\\Scripts\\Activate.ps1 pip install -r requirements.txt -# Run both API and UI +# Run both API and UI (Development) python run.py +# Run in Production (Waitress server) +python run.py --prod + # Or run individually python run.py --mode api python run.py --mode ui -

Configuration lives in app/config.py; override variables via the shell (e.g., STORAGE_ROOT, API_BASE_URL, SECRET_KEY, MAX_UPLOAD_SIZE).

+

Configuration

+

Configuration defaults live in app/config.py. You can override them using environment variables. This is critical for production deployments behind proxies.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableDefaultDescription
API_BASE_URLhttp://127.0.0.1:5000The public URL of the API. Required if running behind a proxy or if the UI and API are on different domains. Ensures presigned URLs are generated correctly.
STORAGE_ROOT./dataDirectory for buckets and objects.
MAX_UPLOAD_SIZE5 GBMax request body size.
SECRET_KEY(Random)Flask session key. Set this in production.
APP_HOST0.0.0.0Bind interface.
APP_PORT5000Listen port.
+