mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-18 02:04:06 -05:00
[PR #23808] [CLOSED] fix: honour HTTP proxy env vars for DuckDuckGo search and URL fetching #98421
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23808
Author: @imoes
Created: 4/16/2026
Status: ❌ Closed
Base:
main← Head:fix/corporate-proxy-web-search📝 Commits (1)
75eea5cfix: honour HTTP proxy env vars for DuckDuckGo search and URL fetching📊 Changes
2 files changed (+15 additions, -7 deletions)
View changed files
📝
backend/open_webui/retrieval/web/duckduckgo.py(+3 -1)📝
backend/open_webui/retrieval/web/utils.py(+12 -6)📄 Description
Pull Request Checklist
devWEB_SEARCH_TRUST_ENVbehaviour unchanged.dev.Problem
Web search failed in environments behind a corporate HTTP proxy (
http_proxy/https_proxyenv vars set in Docker).1. DuckDuckGo search (
duckduckgo.py)DDGS()was instantiated without aproxyargument, so all requests ignored the proxy env vars and were blocked by the firewall.2. URL fetching after search (
utils.py)SafeWebBaseLoader._fetchcreated anaiohttp.ClientSessionwithtrust_enveffectively hardcoded toFalse. BecauseWEB_SEARCH_TRUST_ENVis managed viaPersistentConfig(database-backed), a storedFalsein the DB silently overrides the env var on every container restart — even whenWEB_SEARCH_TRUST_ENV=trueis set in the environment.Fix
duckduckgo.pyhttps_proxy(fallback:http_proxy) from the environment and pass it toDDGS(proxy=proxy).utils.pytrust_env: bool = Falsedefaults toTrueacross all loader classes andget_web_loader().SafeWebBaseLoader._fetch, computeeffective_trust_env = self.trust_env or bool(os.environ.get("https_proxy") or os.environ.get("http_proxy"))so the aiohttp session always uses the proxy when proxy env vars are present, regardless of the DB-cached config value.Reproduction Steps
Deploy Open WebUI in Docker with:
ConnectError; URL fetching →Connection timeoutproxy.ippen.media:80)Changelog Entry
Fixed
duckduckgo.py: Passhttps_proxy/http_proxyenv var toDDGS(proxy=...)so DuckDuckGo search works through a corporate HTTP proxy.utils.py:SafeWebBaseLoader._fetchnow auto-enablestrust_envwhen proxy env vars are present, bypassing the PersistentConfig DB-cachedFalsevalue that would otherwise silently ignore the proxy.utils.py: Changedtrust_envdefault fromFalsetoTruein all loader classes andget_web_loader().Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.