[GH-ISSUE #4385] Unable to access ollama from obsidian plugins app://obsidian.md #28498

Closed
opened 2026-04-22 06:43:16 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @airtonix on GitHub (May 12, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4385

What is the issue?

index.html:1 Access to fetch at 'http://127.0.0.1:11434/api/chat' from origin 'app://obsidian.md' 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.

OS

Linux, macOS, Windows, Docker, WSL2

GPU

Nvidia, AMD, Intel, Apple, Other

CPU

Intel, AMD, Apple, Other

Ollama version

any version

Originally created by @airtonix on GitHub (May 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4385 ### What is the issue? ``` index.html:1 Access to fetch at 'http://127.0.0.1:11434/api/chat' from origin 'app://obsidian.md' 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. ``` ### OS Linux, macOS, Windows, Docker, WSL2 ### GPU Nvidia, AMD, Intel, Apple, Other ### CPU Intel, AMD, Apple, Other ### Ollama version any version
GiteaMirror added the bug label 2026-04-22 06:43:16 -05:00
Author
Owner

@airtonix commented on GitHub (May 12, 2024):

Looks like the solution might be to just add the protocol to the envvar.

Currently Ollama assumes origins are using the http or https protocol:

4ec7445a6f/server/envconfig/config.go (L144-L154)

OLLAMA_ORIGINS=app://obsidian.md,app://obsidian.md/*

4ec7445a6f/docs/faq.md (how-do-i-configure-ollama-server)

<!-- gh-comment-id:2106407904 --> @airtonix commented on GitHub (May 12, 2024): Looks like the solution might be to just add the protocol to the envvar. Currently Ollama assumes origins are using the http or https protocol: https://github.com/ollama/ollama/blob/4ec7445a6f678b6efc773bb9fa886d7c9b075577/server/envconfig/config.go#L144-L154 ``` OLLAMA_ORIGINS=app://obsidian.md,app://obsidian.md/* ``` https://github.com/ollama/ollama/blob/4ec7445a6f678b6efc773bb9fa886d7c9b075577/docs/faq.md#how-do-i-configure-ollama-server
Author
Owner

@airtonix commented on GitHub (May 13, 2024):

Yep this worked, in fact I probably went overboard and just set:

[Service]
Environment="OLLAMA_ORIGINS=*"
<!-- gh-comment-id:2106567962 --> @airtonix commented on GitHub (May 13, 2024): Yep this worked, in fact I probably went overboard and just set: ``` [Service] Environment="OLLAMA_ORIGINS=*" ```
Author
Owner

@nyeisnigh commented on GitHub (May 13, 2024):

Currently stuck on this one. I installed ollama through the .exe file from the site. but cannot get the copilot plugin for obsidian working.

been trying the "OLLAMA_ORIGINS=app://obsidian.md/* ollama serve"

but this results in:

OLLAMA_ORIGINS=app://obsidian.md/* : The term 'OLLAMA_ORIGINS=app://obsidian.md/*' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1

  • OLLAMA_ORIGINS=app://obsidian.md/* ollama serve
  •   + CategoryInfo          : ObjectNotFound: (OLLAMA_ORIGINS=app://obsidian.md/*:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
<!-- gh-comment-id:2107425305 --> @nyeisnigh commented on GitHub (May 13, 2024): Currently stuck on this one. I installed ollama through the .exe file from the site. but cannot get the copilot plugin for obsidian working. been trying the "OLLAMA_ORIGINS=app://obsidian.md/* ollama serve" but this results in: OLLAMA_ORIGINS=app://obsidian.md/* : The term 'OLLAMA_ORIGINS=app://obsidian.md/*' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + OLLAMA_ORIGINS=app://obsidian.md/* ollama serve + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (OLLAMA_ORIGINS=app://obsidian.md/*:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#28498