I’m encountering a CORS-related issue when using the AI Image Analyzer plugin in Obsidian. The following error appears in the browser console when I try to analyze images through the local Ollama API:
Access to fetch at 'http://127.0.0.1:11434/api/pull' 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.
It seems that the Ollama API doesn’t allow requests from the app://obsidian.md origin, resulting in the CORS policy blocking the request.
What I’ve Tried:
Using no-cors in fetch requests: I tried setting the request mode to no-cors to bypass the CORS policy. However, this limits the response data, making the plugin unusable for certain functions.
Modifying API Origin Configuration: I attempted to manually add app://obsidian.md to the allowed origins for Ollama, but this did not resolve the issue.
Request for Improvement:
Could you provide support for allowing requests from app://obsidian.md in the Ollama API’s CORS headers? Alternatively, is there a way to configure this within the plugin to explicitly allow the origin? This would make the API usable within Obsidian’s local web application setup.
Thank you in advance for your assistance! Feel free to reach out if you need additional information or if I can assist with testing a solution.
Description:
Hello,
I’m encountering a CORS-related issue when using the AI Image Analyzer plugin in Obsidian. The following error appears in the browser console when I try to analyze images through the local Ollama API:
It seems that the Ollama API doesn’t allow requests from the
app://obsidian.md
origin, resulting in the CORS policy blocking the request.What I’ve Tried:
Using
no-cors
in fetch requests: I tried setting the request mode tono-cors
to bypass the CORS policy. However, this limits the response data, making the plugin unusable for certain functions.Modifying API Origin Configuration: I attempted to manually add
app://obsidian.md
to the allowed origins for Ollama, but this did not resolve the issue.Request for Improvement:
Could you provide support for allowing requests from
app://obsidian.md
in the Ollama API’s CORS headers? Alternatively, is there a way to configure this within the plugin to explicitly allow the origin? This would make the API usable within Obsidian’s local web application setup.Thank you in advance for your assistance! Feel free to reach out if you need additional information or if I can assist with testing a solution.