fix: compute Ollama Origin header from baseUrl to fix Forbidden error#2843
Merged
ComputelessComputer merged 3 commits intomainfrom Jan 7, 2026
Merged
Conversation
✅ Deploy Preview for hyprnote canceled.
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for howto-fix-macos-audio-selection canceled.
|
✅ Deploy Preview for hyprnote-storybook canceled.
|
3622f36 to
5503a0b
Compare
The previous fix hardcoded Origin to 'http://localhost', but this doesn't work in all Ollama configurations (e.g., when 'Expose Ollama to network' is enabled or when using 127.0.0.1 instead of localhost). This change computes the Origin header from the configured baseUrl, stripping the /v1 suffix to get the correct origin. This ensures the Origin header matches what Ollama expects regardless of the host configuration. Fixes #2123 Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Add the "unsafe-headers" feature to tauri-plugin-http in the desktop Tauri Cargo.toml to allow sending the Origin header. This change addresses warnings about the Origin header being skipped by fetch due to it being a forbidden header, and follows the suggestion to enable the feature when keeping the header is desired.
Allow the tauri HTTP plugin to send forbidden origin headers by enabling its unsafe-headers feature where appropriate. The workspace-level Cargo.toml enables the feature to avoid the fetch-spec warning while the app-specific Cargo.toml keeps the workspace dependency (no extra feature there) to prevent duplicate feature specification and maintain workspace consistency.
5503a0b to
0b6bb82
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes the Ollama Origin header from a hardcoded
http://localhostto dynamically computed from the configured baseUrl. The previous fix (#2178) hardcoded the Origin, but this doesn't work in all Ollama configurations (e.g., when "Expose Ollama to network" is enabled or when using127.0.0.1instead oflocalhost).The fix strips the
/v1suffix from the baseUrl and extracts the origin, sohttp://127.0.0.1:11434/v1becomeshttp://127.0.0.1:11434.Fixes #2123
Review & Testing Checklist for Human
http://127.0.0.1:11434/v1as base URL - verify health check passeshttp://localhost:11434/v1as base URL - verify this still works (regression check)/v1suffix?Recommended test plan:
Notes