From a1eccb0a56fba03498b5097561efcce9a08fe49a Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Mon, 8 Sep 2025 10:40:11 +0200 Subject: [PATCH] Fix the dns issue --- scripts/podx-tools.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/podx-tools.sh b/scripts/podx-tools.sh index 0ab8def..83dd4a6 100755 --- a/scripts/podx-tools.sh +++ b/scripts/podx-tools.sh @@ -61,24 +61,21 @@ fi : "${MEILI_KEY:=${MEILI_MASTER_KEY:-}}" : "${OPENWEBUI_URL:=http://localhost:3003}" +: "${OPENWEBUI_URL_HOST:=}" : "${OPENWEBUI_API_KEY:=}" # Resolve a working OpenWebUI base URL (fallback from host.docker.internal -> localhost) _owui_url() { - local u="${OPENWEBUI_URL:-http://localhost:3003}" - # quick health check - local code - code=$(curl -sS -o /dev/null -w "%{http_code}" "$u/api/health" || true) - if [ "$code" != "200" ]; then - if [[ "$u" == *host.docker.internal* ]]; then - local alt="${u/host.docker.internal/localhost}" - code=$(curl -sS -o /dev/null -w "%{http_code}" "$alt/api/health" || true) - if [ "$code" = "200" ]; then - echo "$alt" - return - fi - fi + # If a host-only override is provided, prefer it unconditionally + local host_u="${OPENWEBUI_URL_HOST:-}" + if [ -n "$host_u" ]; then + echo "$host_u" + return fi + # Otherwise use OPENWEBUI_URL (defaulting to localhost), and rewrite + # host.docker.internal -> localhost so it always resolves on the host + local u="${OPENWEBUI_URL:-http://localhost:3003}" + u="${u//host.docker.internal/localhost}" echo "$u" }