mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
the problem of CORS #125
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 @heweapon on GitHub (Dec 27, 2023).
Description
I installed Docker on my Intranet server, and used Docker to install ollama and ollama-webui. But I had a CORS problem when I accessed 172.16.120.14:3000 in my browser.
Environment
Browser Console Logs:

Access to fetch at 'http://172.16.120.14:11434/api/tags' from origin 'http://172.16.120.14:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Docker Container Logs:
[Include relevant Docker container logs, if applicable]
ollama:
[GIN] 2023/12/27 - 06:07:12 | 403 | 39.2µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 06:47:51 | 403 | 35.61µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 06:47:51 | 403 | 7.128µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 06:47:51 | 403 | 5.274µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 07:20:38 | 403 | 38.184µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:20:38 | 403 | 7.037µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:20:38 | 403 | 5.373µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 07:26:08 | 403 | 46.365µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:26:08 | 403 | 8.551µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:26:08 | 403 | 5.66µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 07:26:24 | 403 | 7.069µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:26:24 | 403 | 5.716µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 07:26:24 | 403 | 5.52µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 08:01:44 | 403 | 44.372µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 08:01:44 | 403 | 8.07µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 08:01:44 | 403 | 5.88µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 08:33:52 | 403 | 39.596µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 08:33:52 | 403 | 5.538µs | 118.229.3.242 | OPTIONS "/api/tags"
[GIN] 2023/12/27 - 08:33:52 | 403 | 5.496µs | 118.229.3.242 | OPTIONS "/api/version"
[GIN] 2023/12/27 - 08:40:40 | 403 | 43.403µs | 118.229.3.242 | OPTIONS "/api/tags"
ollama-webui:
INFO: Started server process [7]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO: 172.16.45.133:49450 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:49450 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:49817 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:49817 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:49875 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:49875 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:49921 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:49921 - "GET / HTTP/1.1" 200 OK
INFO: Started server process [7]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO: 172.16.45.133:61932 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:61932 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:54970 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:54970 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:57974 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/entry/start.8115b78a.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/chunks/scheduler.0545783f.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57975 - "GET /_app/immutable/chunks/singletons.a381321d.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/chunks/index.323ffc89.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57975 - "GET /_app/immutable/entry/app.019d04ff.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/chunks/index.3f9f9994.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/nodes/0.4c5a803d.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/chunks/Toaster.svelte_svelte_type_style_lang.7710012c.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57975 - "GET /_app/immutable/assets/Toaster.3a6d0da3.css HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/chunks/navigation.5cf1b549.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/chunks/each.2de3855a.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57975 - "GET /_app/immutable/assets/0.d675630a.css HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/nodes/1.715ead6c.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/chunks/stores.ab55a33e.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57978 - "GET /_app/immutable/nodes/2.916338f1.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57975 - "GET /_app/immutable/chunks/index.181feede.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57979 - "GET /_app/immutable/chunks/Advanced.fdb0c2b3.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57976 - "GET /_app/immutable/assets/2.f48dc938.css HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57980 - "GET /_app/immutable/nodes/3.b1332545.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57978 - "GET /_app/immutable/chunks/Navbar.028211d8.js HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /_app/immutable/assets/Navbar.e3b04202.css HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:57974 - "GET /assets/fonts/Arimo-Variable.ttf HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:57974 - "GET /ollama.png HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:63150 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:63389 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:63389 - "GET /favicon.png HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:63389 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:63390 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:65151 - "GET / HTTP/1.1" 200 OK
INFO: 172.16.45.133:50175 - "GET /manifest.json HTTP/1.1" 304 Not Modified
INFO: 172.16.45.133:55213 - "GET / HTTP/1.1" 200 OK
@tjbck commented on GitHub (Dec 27, 2023):
Hi! Could you verify that ollama api url is set to

/ollama/apiin the webui settings? Thanks.@heweapon commented on GitHub (Dec 27, 2023):
yes.But new problem as follow:

"HTTPConnectionPool(host='host.docker.internal', port=11434): Max retries exceeded with url: /api/tags (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fd3a11aef10>, 'Connection to host.docker.internal timed out. (connect timeout=None)'))"
@tjbck commented on GitHub (Dec 27, 2023):
You might want to try this method: https://github.com/ollama-webui/ollama-webui/blob/main/TROUBLESHOOTING.md#running-ollama-webui-as-a-container-on-wsl-ubuntu
Keep us updated!
@heweapon commented on GitHub (Dec 27, 2023):
OK.Thank you
@heweapon commented on GitHub (Dec 27, 2023):
Sorry. I still can't solve my problem. I deployed it on the server, not localhost.
@tjbck commented on GitHub (Dec 27, 2023):
Is the webui running on the same server as your ollama instance?