Allow requests from Tauri
$ OLLAMA_ORIGINS=tauri://localhost ollama serve
panic: bad origin: origins must contain '*' or include http://,https://,chrome-extension://,safari-extension://,moz-extension://,ms-browser-extension://
Workaround (updated):
OLLAMA_ORIGINS=*://localhost ollama serve
Besides adding the tauri:// schema, maybe also enable access by default for tauri://localhost and tauri://127.0.0.1
Checking the ollama code, it seems to be Gin Cors - related. Opened https://github.com/gin-contrib/cors/issues/135
Note: above workaround does not seem to work on Windows (is OLLAMA_ORIGINS env var ignored?)
Also, see PR https://github.com/ollama/ollama/pull/2441 which prepares the code for adding extra schemes, like tauri://
Thank you for the update about Gin. We'll look into bumping our gin version.
Thanks. In https://github.com/ollama/ollama/pull/2441 I bumped Gin CORS (well, go mod updated a bit more than that) and added support by default for requests comming from Tauri apps (like my LLaMazing app). Motivation being to not ask users to fiddle with OLLAMA_ORIGINS.
Note: above workaround does not seem to work on Windows (is OLLAMA_ORIGINS env var ignored?)
Also, see PR #2441 which prepares the code for adding extra schemes, like tauri://
Can you confirm if you're still experiencing the issue where the OLLAMA_ORIGINS environment variable appears to be disregarded on Windows? If this problem persists, we're more than willing to investigate further and will consider opening a new issue to address this specifically.
Regarding PR #2441, while we appreciate the initiative to prepare the code for additional schemes like tauri://, we currently do not plan to include default support for Tauri in our CORS headers, as the wildcard * can be used for broader access. However, we truly value your contribution and will keep this in mind for future updates.
I'll be closing this thread for now, but please don't hesitate to reopen a new issue regarding the OLLAMA_ORIGINS on Windows if the problem continues, or reach out directly here, and I'll be happy to assist further.