Fix the dns issue
This commit is contained in:
@@ -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"
|
||||
# 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
|
||||
fi
|
||||
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"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user