[GH-ISSUE #3746] Ollama response 403 to OPTION requests #64347

Closed
opened 2026-05-03 17:13:45 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @zrll12 on GitHub (Apr 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3746

What is the issue?

I was using Next Chat to communicate with Ollama, but Next Chat returns

{
  "error": true,
  "message": "Load failed"
}

and the log of Ollama says

[GIN] 2024/04/19 - 11:58:33 | 403 |      48.166µs |       127.0.0.1 | OPTIONS  "/v1/chat/completions"
[GIN] 2024/04/19 - 11:58:35 | 403 |       9.791µs |       127.0.0.1 | OPTIONS  "/v1/chat/completions"

The OLLAMA_ORIGINS variable has been set to *

Can run with the following curl

curl http://localhost:11434/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "llama2",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant."
            },
            {
                "role": "user",
                "content": "Hello!"
            }
        ]
    }'

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.1.32

Originally created by @zrll12 on GitHub (Apr 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3746 ### What is the issue? I was using Next Chat to communicate with Ollama, but Next Chat returns ``` json { "error": true, "message": "Load failed" } ``` and the log of Ollama says ``` [GIN] 2024/04/19 - 11:58:33 | 403 | 48.166µs | 127.0.0.1 | OPTIONS "/v1/chat/completions" [GIN] 2024/04/19 - 11:58:35 | 403 | 9.791µs | 127.0.0.1 | OPTIONS "/v1/chat/completions" ``` The `OLLAMA_ORIGINS` variable has been set to `*` Can run with the following curl ``` curl http://localhost:11434/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "llama2", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }' ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.1.32
GiteaMirror added the bug label 2026-05-03 17:13:45 -05:00
Author
Owner

@chunzha1 commented on GitHub (Apr 21, 2024):

same for me. it's that any solutions?

<!-- gh-comment-id:2068124115 --> @chunzha1 commented on GitHub (Apr 21, 2024): same for me. it's that any solutions?
Author
Owner

@chunzha1 commented on GitHub (Apr 21, 2024):

截屏2024-04-22 00 30 27 I found that it can be used in OpenAI, but got a 403 error when using it on Ollama...
<!-- gh-comment-id:2068127992 --> @chunzha1 commented on GitHub (Apr 21, 2024): <img width="971" alt="截屏2024-04-22 00 30 27" src="https://github.com/ollama/ollama/assets/125763492/ddc24191-5e65-497c-b8d5-e76e916a8f1b"> I found that it can be used in OpenAI, but got a 403 error when using it on Ollama...
Author
Owner

@jmorganca commented on GitHub (May 10, 2024):

This should be fixed on main and in the next release of Ollama

<!-- gh-comment-id:2103630494 --> @jmorganca commented on GitHub (May 10, 2024): This should be fixed on `main` and in the next release of Ollama
Author
Owner

@haohaifeng002 commented on GitHub (Dec 20, 2024):

Version 0.5.4 still has not resolved the issue

<!-- gh-comment-id:2556730833 --> @haohaifeng002 commented on GitHub (Dec 20, 2024): Version 0.5.4 still has not resolved the issue
Author
Owner

@sdjn-kzero commented on GitHub (Feb 14, 2025):

I changed the installation method and used brew install ollama, then found homebrew.mxcl.ollama.plist in /opt/homebrew/Cellar/ollama/0.5.10.

<key>ProgramArguments</key>
<array>
	<string>/opt/homebrew/opt/ollama/bin/ollama</string>
	<string>serve</string>
</array>

I added

<key>EnvironmentVariables</key>
<dict>
    <key>OLLAMA_ORIGINS</key>
    <string>*</string>
    <key>OLLAMA_CORS</key>
    <string>true</string>
</dict>	
 

After restarting, the problem was solved.

<!-- gh-comment-id:2659833872 --> @sdjn-kzero commented on GitHub (Feb 14, 2025): I changed the installation method and used brew install ollama, then found homebrew.mxcl.ollama.plist in /opt/homebrew/Cellar/ollama/0.5.10. ```xml <key>ProgramArguments</key> <array> <string>/opt/homebrew/opt/ollama/bin/ollama</string> <string>serve</string> </array> ``` I added ```xml <key>EnvironmentVariables</key> <dict> <key>OLLAMA_ORIGINS</key> <string>*</string> <key>OLLAMA_CORS</key> <string>true</string> </dict> ``` After restarting, the problem was solved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#64347