ollama icon indicating copy to clipboard operation
ollama copied to clipboard

Allow requests from Tauri

Open da-z opened this issue 2 years ago • 3 comments

$ 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

da-z avatar Jan 31 '24 19:01 da-z

Checking the ollama code, it seems to be Gin Cors - related. Opened https://github.com/gin-contrib/cors/issues/135

da-z avatar Jan 31 '24 20:01 da-z

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://

da-z avatar Feb 16 '24 16:02 da-z

Thank you for the update about Gin. We'll look into bumping our gin version.

bmizerany avatar Mar 11 '24 23:03 bmizerany

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.

da-z avatar Mar 12 '24 06:03 da-z

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.

bmizerany avatar Mar 12 '24 18:03 bmizerany