[GH-ISSUE #2425] OpenAI API 403 error with 'Origin' http request header #63453

Closed
opened 2026-05-03 13:35:03 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @wizd on GitHub (Feb 9, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2425

Hello, gratz on OpenAI API release! My life is much easier for now.

When testing the API I found when the browser extension sends 'Origin' header, the API always return 403 error immediately, like bellow:

curl http://localhost:5310/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Origin: chrome-extension://bpoadfkcbjbfhfodiogcnhade..f" \
    -d '{"model":"gpt-3.5-turbo-1106","temperature":0,"messages":[{"role":"system","content":"You are a professional, authentic translation engine, only returns translations."},{"role":"user","content":"Translate the text to Simplified Chinese Language, please do not explain my original text.:\\n\\nHello world"}]}'

which returns:

HTTP/1.1 403 Forbidden\r
Date: Fri, 09 Feb 2024 09:15:22 GMT\r
Content-Length: 0\r
\r

Ollama server log:

[GIN] 2024/02/09 - 09:21:34 | 403 |      14.458µs |      172.19.0.1 | POST     "/v1/chat/completions"
Originally created by @wizd on GitHub (Feb 9, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2425 Hello, gratz on OpenAI API release! My life is much easier for now. When testing the API I found when the browser extension sends 'Origin' header, the API always return 403 error immediately, like bellow: ``` curl http://localhost:5310/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Origin: chrome-extension://bpoadfkcbjbfhfodiogcnhade..f" \ -d '{"model":"gpt-3.5-turbo-1106","temperature":0,"messages":[{"role":"system","content":"You are a professional, authentic translation engine, only returns translations."},{"role":"user","content":"Translate the text to Simplified Chinese Language, please do not explain my original text.:\\n\\nHello world"}]}' ``` which returns: ``` HTTP/1.1 403 Forbidden\r Date: Fri, 09 Feb 2024 09:15:22 GMT\r Content-Length: 0\r \r ``` Ollama server log: ``` [GIN] 2024/02/09 - 09:21:34 | 403 | 14.458µs | 172.19.0.1 | POST "/v1/chat/completions" ```
GiteaMirror added the question label 2026-05-03 13:35:03 -05:00
Author
Owner

@jmorganca commented on GitHub (Feb 9, 2024):

Hi @wizd have you tried the OLLAMA_ORIGINS environment variable to allow chrome extension access? https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama

Sorry this isn't easier – improving access permissions for browser/extensions is a work in progress

<!-- gh-comment-id:1935916408 --> @jmorganca commented on GitHub (Feb 9, 2024): Hi @wizd have you tried the `OLLAMA_ORIGINS` environment variable to allow chrome extension access? https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama Sorry this isn't easier – improving access permissions for browser/extensions is a work in progress
Author
Owner

@wizd commented on GitHub (Feb 9, 2024):

Hi @wizd have you tried the OLLAMA_ORIGINS environment variable to allow chrome extension access? https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama

Sorry this isn't easier – improving access permissions for browser/extensions is a work in progress

Thank you! I should check the doc earlier...

<!-- gh-comment-id:1935994195 --> @wizd commented on GitHub (Feb 9, 2024): > Hi @wizd have you tried the `OLLAMA_ORIGINS` environment variable to allow chrome extension access? https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama > > Sorry this isn't easier – improving access permissions for browser/extensions is a work in progress Thank you! I should check the doc earlier...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#63453