mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #12980] issue: Web search failing in proxy environment (socket.gaierror: [Errno -2] Name or service not known) #55442
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?
Originally created by @jessiewbailey on GitHub (Apr 17, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12980
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.5 (latest)
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Entering a query and selecting Web Search with a query such as "What is the weather today" should produce web results.
Actual Behavior
UI displays "No results" and then returns an answer generated purely by the LLM without any web search content.
Steps to Reproduce
In a proxied environment using DuckDuckGo as the search engine. The error logs indicate the issue stems from a call to socket.getaddrinfo() which returns socket.gaierror: [Errno -2] Name or service not known. This appears to be due to that function not utilizing proxies. I can reproduce this error using the following script in a proxied environment:
import socket
addr_info = socket.getaddrinfo("www.google.com", None)
Logs & Screenshots
Full logs are attached, but keeping two snippets which I suspect may be relevant:
fdde:68d2:461a:ac00:4f64:2876:fa1c:e7bc:0 - "GET /api/v1/tools/ HTTP/1.1" 200 - {}
/usr/local/lib/python3.11/site-packages/aiohttp/connector.py:1054: RuntimeWarning: An HTTPS request is being sent through an HTTPS proxy. This support for TLS in TLS is known to be disabled in the stdlib asyncio (Python <3.11). This is why you'll probably see an error in the log below.
It is possible to enable it via monkeypatching. For more details, see:
You can temporarily patch this as follows:
https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support
https://github.com/aio-libs/aiohttp/discussions/6044
_, proto = await self._create_proxy_connection(req, traces, timeout)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2025-04-17 12:53:42.189 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - fdde:68d2:461a:ac00:4f64:2876:fa1c:e7bc:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-04-17 12:54:26.321 | INFO | open_webui.routers.retrieval:process_web_search:1477 - trying to web search with ('duckduckgo', 'current weather conditions') - {}
2025-04-17 12:54:27.500 | INFO | duckduckgo_search.duckduckgo_search:_text_lite:301 - response: https://lite.duckduckgo.com/lite/ 200 - {}
2025-04-17 12:54:27.521 | ERROR | open_webui.routers.retrieval:process_web_search:1545 - [Errno -2] Name or service not known - {}
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 10, in
sys.exit(main())
│ │ └
│ └
└ <module 'sys' (built-in)>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in call
return self.main(args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function BaseCommand.main at 0x7ffb7cc55e40>
└
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
│ │ └ <click.core.Context object at 0x7ffb7d90e610>
│ └ <function Command.invoke at 0x7ffb7cc56a20>
└
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
│ │ │ │ └ <click.core.Context object at 0x7ffb7d90e610>
│ │ │ └ <function main at 0x7ffb7c82d580>
│ │ └
│ └ <function Context.invoke at 0x7ffb7cc553a0>
└ <click.core.Context object at 0x7ffb7d90e610>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
return __callback(args, **kwargs)
│ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
└ ()
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 412, in main
run(
└ <function run at 0x7ffb7cc63ec0>
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
server.run()
│ └ <function Server.run at 0x7ffb7cac9300>
└ <uvicorn.server.Server object at 0x7ffb7caf0950>
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0x7ffb7cac93a0>
│ │ └ <uvicorn.server.Server object at 0x7ffb7caf0950>
│ └ <function run at 0x7ffb7cfccb80>
└ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/init.py'>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0x7ffb7c9e67a0>
│ └ <function Runner.run at 0x7ffb7ce3c720>
└ <asyncio.runners.Runner object at 0x7ffb7c821cd0>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:70> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0x7ffb7c86d220>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0x7ffb7c821cd0>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 141, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
│ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0x7ffb15911760>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7ffb16d86310>
└ <open_webui.main.RedirectMiddleware object at 0x7ffb175f4cd0>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0x7ffb15911760>
│ │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ │ │ └ <starlette.requests.Request object at 0x7ffb15d43c50>
│ │ └ <fastapi.routing.APIRouter object at 0x7ffb179ec0d0>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7ffb16d86310>
└ <function wrap_app_handling_exceptions at 0x7ffb79eab2e0>
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15913e20>
│ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
└ <fastapi.routing.APIRouter object at 0x7ffb179ec0d0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15913e20>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7ffb179ec0d0>>
└ <fastapi.routing.APIRouter object at 0x7ffb179ec0d0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15913e20>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ └ <function Route.handle at 0x7ffb79f009a0>
└ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15913e20>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ └ <function request_response..app at 0x7ffb16540680>
└ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15913e20>
│ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
│ │ └ <starlette.requests.Request object at 0x7ffb15d40490>
│ └ <function request_response..app..app at 0x7ffb15dd13a0>
└ <function wrap_app_handling_exceptions at 0x7ffb79eab2e0>
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7ffb15dd3060>
│ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x7ffb15913ce0>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.42.8.114', 8080), '...
└ <function request_response..app..app at 0x7ffb15dd13a0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
│ └ <starlette.requests.Request object at 0x7ffb15d40490>
└ <function get_request_handler..app at 0x7ffb165405e0>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
└ <function run_endpoint_function at 0x7ffb79f027a0>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
│ │ └ {'user': UserModel(id='ddfcd532-94a1-4520-b7a0-21331cff9de6', name='Jessie', email='name@domain.com', role='admin', profi...
│ └ <function chat_completion at 0x7ffb169c1ee0>
└ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
File "/app/backend/open_webui/main.py", line 1130, in chat_completion
form_data, metadata, events = await process_chat_payload(
│ │ └ <function process_chat_payload at 0x7ffb17de7100>
│ └ {'user_id': 'ddfcd532-94a1-4520-b7a0-21331cff9de6', 'chat_id': '6a77444d-01fa-4d01-b3b2-c0da6dd816a4', 'message_id': 'd3dd594...
└ {'stream': True, 'model': 'gemma3:27b', 'messages': [{'role': 'user', 'content': 'weather today'}], 'metadata': {'user_id': '...
File "/app/backend/open_webui/utils/middleware.py", line 796, in process_chat_payload
form_data = await chat_web_search_handler(
└ <function chat_web_search_handler at 0x7ffb17de5b20>
File "/app/backend/open_webui/utils/middleware.py", line 372, in chat_web_search_handler
results = await process_web_search(
└ <function process_web_search at 0x7ffb1b2c6c00>
File "/app/backend/open_webui/retrieval/web/utils.py", line 594, in get_web_loader
safe_urls = safe_validate_urls([urls] if isinstance(urls, str) else urls)
│ │ │ └ ['https://www.accuweather.com/en/us/ninnescah-township/67146/hourly-weather-forecast/2639795', 'https://www.accuweather.com/e...
│ │ └ ['https://www.accuweather.com/en/us/ninnescah-township/67146/hourly-weather-forecast/2639795', 'https://www.accuweather.com/e...
│ └ ['https://www.accuweather.com/en/us/ninnescah-township/67146/hourly-weather-forecast/2639795', 'https://www.accuweather.com/e...
└ <function safe_validate_urls at 0x7ffb1c1a8fe0>
File "/app/backend/open_webui/retrieval/web/utils.py", line 73, in safe_validate_urls
if validate_url(u):
│ └ 'https://www.accuweather.com/en/us/ninnescah-township/67146/hourly-weather-forecast/2639795'
└ <function validate_url at 0x7ffb1ff21d00>
File "/app/backend/open_webui/retrieval/web/utils.py", line 53, in validate_url
ipv4_addresses, ipv6_addresses = resolve_hostname(parsed_url.hostname)
│ │ └ <property object at 0x7ffb7cd84900>
│ └ ParseResult(scheme='https', netloc='www.accuweather.com', path='/en/us/ninnescah-township/67146/hourly-weather-forecast/26397...
└ <function resolve_hostname at 0x7ffb1c1f0a40>
File "/app/backend/open_webui/retrieval/web/utils.py", line 82, in resolve_hostname
addr_info = socket.getaddrinfo(hostname, None)
│ │ └ 'www.accuweather.com'
│ └ <function getaddrinfo at 0x7ffb7d63a340>
└ <module 'socket' from '/usr/local/lib/python3.11/socket.py'>
File "/usr/local/lib/python3.11/socket.py", line 974, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
│ │ │ │ │ │ │ └ 0
│ │ │ │ │ │ └ 0
│ │ │ │ │ └ 0
│ │ │ │ └ 0
│ │ │ └ None
│ │ └ 'www.accuweather.com'
│ └
└ <module '_socket' from '/usr/local/lib/python3.11/lib-dynload/_socket.cpython-311-x86_64-linux-gnu.so'>
socket.gaierror: [Errno -2] Name or service not known
Additional Information
No response
@tth37 commented on GitHub (Apr 17, 2025):
What are your proxy environment settings? It doesn't seem to be an issue related to open-webui.
@jessiewbailey commented on GitHub (Apr 17, 2025):
Yes I mean it seems like it is an issue with the choice to use socket.getaddrinfo() unless I am mistaken and that respects proxies?
The other detail which may or may not matter is this is running in Kubernetes as a non-root user.
@tth37 commented on GitHub (Apr 17, 2025):
I cant reproduce this error in proxied environment:
Maybe check the DNS configurations in your k8s cluster, it doesn't look like to be an error related to http(s) proxy. What is the result when you run
dig www.google.comin your open-webui k8s container?@jessiewbailey commented on GitHub (Apr 17, 2025):
ollama@openwebui-test-54868b6756-pqrd2:/app/backend$ dig www.google.com
; <<>> DiG 9.18.33-1~deb12u2-Debian <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 41515
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 22a2864f1c127d42 (echoed)
;; QUESTION SECTION:
;www.google.com. IN A
;; AUTHORITY SECTION:
. 30 IN SOA zzz.com. HostMaster. 0 86400 86400 14515200 600
;; Query time: 1 msec
;; SERVER: 10.43.0.10#53(10.43.0.10) (UDP)
;; WHEN: Thu Apr 17 18:13:50 UTC 2025
;; MSG SIZE rcvd: 107
@tth37 commented on GitHub (Apr 17, 2025):
Check your DNS name server at 10.43.0.10, it's not functioning
@jessiewbailey commented on GitHub (Apr 17, 2025):
Apparently this DNS server is only configured to resolve internal addresses and dig does not support proxies. Curl or wget would work.
@tth37 commented on GitHub (Apr 17, 2025):
What's the result of
curl www.google.com -v, does it work?@jessiewbailey commented on GitHub (Apr 17, 2025):
Yes it works (see below) also things like requests or httpx will work within python (correctly picking up the proxy servers):
curl -v www.google.com
< HTTP/1.1 200 OK
< Date: Thu, 17 Apr 2025 18:52:51 GMT
< Server: gws
< Expires: -1
< Cache-Control: private, max-age=0
< Content-Type: text/html; charset=ISO-8859-1
< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-OeOc-munwdHy2zvOdaVacg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Accept-Ranges: none
< Vary: Accept-Encoding
< Set-Cookie: AEC=AVcja2eLY9X0yVmo70CCf63Ypd5ab3a5ThGx26JZeeVV7qWNcsB3BbGiVw; expires=Tue, 14-Oct-2025 18:52:51 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
< Set-Cookie: NID=523=M-SP3CvSogdgCZzXewYlhf1PuAOJhQEvWFp_Er1lF5goxdoVu-Vb2PUUndqQYeSNiOgFECrD6pGaE_Wdn-h9qaVaAxjea598hmGEmP81Sg6u1nDtTCkNagfha5e1-UlCEfNZ3ZwS36HtfSC15EKsf2X4X6fiTs1KgOlFwohWmPJf0taxJFqetTqQhot9WPlEgsVOQaq40IprQaQbzQ7XK9GEH5czL-qX9ojfrOEVsMDdAtl5XseRcQ; expires=Fri, 17-Oct-2025 18:52:51 GMT; path=/; domain=.google.com; HttpOnly
< Transfer-Encoding: chunked
<
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><script nonce="OeOc-munwdHy2zvOdaVacg">(function(){var _g={kEI:'A04BaOf5Maah5NoP8qLS0Qo',kEXPI:'0,202791,3497503,1090,538661,48791,30022,16105,344796,94243,195801,5241681,40,68,85,36812450,25228681,11555,112433,14280,14115,11943,10970,34212,5382,2663,3431,3319,23879,9139,4599,328,6225,1116,33194,29855,1346,13703,8210,3286,4134,12133,18247,12505,2,15826,24331,18558,7218,4105,11053,351,13699,951,2149,4607,7,5774,4310,6423,1844,7,4,893,3170,10960,7264,4899,2727,1634,3261,459,2531,28,7,1,
@tth37 commented on GitHub (Apr 17, 2025):
According to
95f579c, try setting envENABLE_RAG_LOCAL_WEB_FETCH=true? By setting this open-webui may bypass local DNS query (As in your case local DNS server cannot resolve external domains)@jessiewbailey commented on GitHub (Apr 17, 2025):
This seems to be working you are a wiz!!!