[GH-ISSUE #4115] Error 403 when trying to call api/chat or api/generate from REST client #2557

Closed
opened 2026-04-12 12:52:55 -05:00 by GiteaMirror · 17 comments
Owner

Originally created by @MaheshAwasare on GitHub (May 3, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4115

What is the issue?

Hi, Downloaded latest llama3 model after installing ollama for Windows from https://www.ollama.com

I have downloaded llama3 latest model.

C:\Windows\System32>ollama list
NAME            ID              SIZE    MODIFIED
llama3:latest   a6990ed6be41    4.7 GB  45 hours ago

On command prompt it works fine and provides answers.

image

However using any rest client it gives 403 forbidden error.

image

I also looked at https://github.com/ollama/ollama/pull/743/commits for reference but I think it is still not solving the issue.

This is model information that it prints out at the beginning.

`llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = llama
llama_model_loader: - kv   1:                               general.name str              = Meta-Llama-3-8B-Instruct
llama_model_loader: - kv   2:                          llama.block_count u32              = 32
llama_model_loader: - kv   3:                       llama.context_length u32              = 8192
llama_model_loader: - kv   4:                     llama.embedding_length u32              = 4096
llama_model_loader: - kv   5:                  llama.feed_forward_length u32              = 14336
llama_model_loader: - kv   6:                 llama.attention.head_count u32              = 32
llama_model_loader: - kv   7:              llama.attention.head_count_kv u32              = 8
llama_model_loader: - kv   8:                       llama.rope.freq_base f32              = 500000.000000
llama_model_loader: - kv   9:     llama.attention.layer_norm_rms_epsilon f32              = 0.000010
llama_model_loader: - kv  10:                          general.file_type u32              = 2
llama_model_loader: - kv  11:                           llama.vocab_size u32              = 128256
llama_model_loader: - kv  12:                 llama.rope.dimension_count u32              = 128
llama_model_loader: - kv  13:                       tokenizer.ggml.model str              = gpt2
llama_model_loader: - kv  14:                      tokenizer.ggml.tokens arr[str,128256]  = ["!", "\"", "#", "$", "%", "&", "'", ...
llama_model_loader: - kv  15:                  tokenizer.ggml.token_type arr[i32,128256]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  16:                      tokenizer.ggml.merges arr[str,280147]  = ["Ġ Ġ", "Ġ ĠĠĠ", "ĠĠ ĠĠ", "...
llama_model_loader: - kv  17:                tokenizer.ggml.bos_token_id u32              = 128000
llama_model_loader: - kv  18:                tokenizer.ggml.eos_token_id u32              = 128001
llama_model_loader: - kv  19:                    tokenizer.chat_template str              = {% set loop_messages = messages %}{% ...
llama_model_loader: - kv  20:               general.quantization_version u32              = 2`

Following block contains both 200 request (from command prompt) and 403 from rest client.

[GIN] 2024/05/03 - 08:30:49 | 200 |   14.1625275s |       127.0.0.1 | POST     "/api/chat"
{"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":56979,"status":200,"tid":"31556","timestamp":1714705249}
[GIN] 2024/05/03 - 08:31:20 | 403 |      2.0144ms |       127.0.0.1 | POST     "/api/chat"
{"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":6,"tid":"13712","timestamp":1714705438}
{"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438}
{"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":7,"tid":"13712","timestamp":1714705438}
{"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438}
{"function":"log_server_request","level":"INFO","line":2744,"method":"POST","msg":"request","params":{},"path":"/tokenize","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438}
{"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":8,"tid":"13712","timestamp":1714705438}
{"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438}
{"function":"launch_slot_with_data","level":"INFO","line":833,"msg":"slot is processing task","slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438}
{"function":"update_slots","ga_i":0,"level":"INFO","line":1819,"msg":"slot progression","n_past":0,"n_past_se":0,"n_prompt_tokens_processed":12,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438}
{"function":"update_slots","level":"INFO","line":1843,"msg":"kv cache rm [p0, end)","p0":0,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438}
{"function":"print_timings","level":"INFO","line":276,"msg":"prompt eval time     =    2535.21 ms /    12 tokens (  211.27 ms per token,     4.73 tokens per second)","n_prompt_tokens_processed":12,"n_tokens_second":4.733339434081937,"slot_id":0,"t_prompt_processing":2535.208,"t_token":211.26733333333334,"task_id":9,"tid":"13712","timestamp":1714705443}
{"function":"print_timings","level":"INFO","line":290,"msg":"generation eval time =    2561.01 ms /     8 runs   (  320.13 ms per token,     3.12 tokens per second)","n_decoded":8,"n_tokens_second":3.123766356333495,"slot_id":0,"t_token":320.126375,"t_token_generation":2561.011,"task_id":9,"tid":"13712","timestamp":1714705443}
{"function":"print_timings","level":"INFO","line":299,"msg":"          total time =    5096.22 ms","slot_id":0,"t_prompt_processing":2535.208,"t_token_generation":2561.011,"t_total":5096.219,"task_id":9,"tid":"13712","timestamp":1714705443}
{"function":"update_slots","level":"INFO","line":1651,"msg":"slot released","n_cache_tokens":20,"n_ctx":2048,"n_past":19,"n_system_tokens":0,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705443,"truncated":false}
{"function":"log_server_request","level":"INFO","line":2744,"method":"POST","msg":"request","params":{},"path":"/completion","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705443}[GIN] 2024/05/03 - 08:34:03 | 200 |    5.1187818s |       127.0.0.1 | POST     "/api/chat"

Is it some known issue or am I missing something?

OS

Windows

GPU

No response

CPU

Intel

Ollama version

0.1.33

Originally created by @MaheshAwasare on GitHub (May 3, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4115 ### What is the issue? Hi, Downloaded latest llama3 model after installing ollama for **Windows** from https://www.ollama.com I have downloaded llama3 latest model. ``` C:\Windows\System32>ollama list NAME ID SIZE MODIFIED llama3:latest a6990ed6be41 4.7 GB 45 hours ago ``` On command prompt it works fine and provides answers. ![image](https://github.com/ollama/ollama/assets/48666285/eb661b3e-e329-48f3-8478-12099ca9aaa1) However using any rest client it gives 403 forbidden error. ![image](https://github.com/ollama/ollama/assets/48666285/6047ac11-821a-4a12-b34f-2053ffe7f696) I also looked at https://github.com/ollama/ollama/pull/743/commits for reference but I think it is still not solving the issue. This is model information that it prints out at the beginning. ``` `llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = llama llama_model_loader: - kv 1: general.name str = Meta-Llama-3-8B-Instruct llama_model_loader: - kv 2: llama.block_count u32 = 32 llama_model_loader: - kv 3: llama.context_length u32 = 8192 llama_model_loader: - kv 4: llama.embedding_length u32 = 4096 llama_model_loader: - kv 5: llama.feed_forward_length u32 = 14336 llama_model_loader: - kv 6: llama.attention.head_count u32 = 32 llama_model_loader: - kv 7: llama.attention.head_count_kv u32 = 8 llama_model_loader: - kv 8: llama.rope.freq_base f32 = 500000.000000 llama_model_loader: - kv 9: llama.attention.layer_norm_rms_epsilon f32 = 0.000010 llama_model_loader: - kv 10: general.file_type u32 = 2 llama_model_loader: - kv 11: llama.vocab_size u32 = 128256 llama_model_loader: - kv 12: llama.rope.dimension_count u32 = 128 llama_model_loader: - kv 13: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 14: tokenizer.ggml.tokens arr[str,128256] = ["!", "\"", "#", "$", "%", "&", "'", ... llama_model_loader: - kv 15: tokenizer.ggml.token_type arr[i32,128256] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 16: tokenizer.ggml.merges arr[str,280147] = ["Ġ Ġ", "Ġ ĠĠĠ", "ĠĠ ĠĠ", "... llama_model_loader: - kv 17: tokenizer.ggml.bos_token_id u32 = 128000 llama_model_loader: - kv 18: tokenizer.ggml.eos_token_id u32 = 128001 llama_model_loader: - kv 19: tokenizer.chat_template str = {% set loop_messages = messages %}{% ... llama_model_loader: - kv 20: general.quantization_version u32 = 2` ``` Following block contains both 200 request (from command prompt) and 403 from rest client. ``` [GIN] 2024/05/03 - 08:30:49 | 200 | 14.1625275s | 127.0.0.1 | POST "/api/chat" {"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":56979,"status":200,"tid":"31556","timestamp":1714705249} [GIN] 2024/05/03 - 08:31:20 | 403 | 2.0144ms | 127.0.0.1 | POST "/api/chat" {"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":6,"tid":"13712","timestamp":1714705438} {"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438} {"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":7,"tid":"13712","timestamp":1714705438} {"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438} {"function":"log_server_request","level":"INFO","line":2744,"method":"POST","msg":"request","params":{},"path":"/tokenize","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438} {"function":"process_single_task","level":"INFO","line":1513,"msg":"slot data","n_idle_slots":1,"n_processing_slots":0,"task_id":8,"tid":"13712","timestamp":1714705438} {"function":"log_server_request","level":"INFO","line":2744,"method":"GET","msg":"request","params":{},"path":"/health","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705438} {"function":"launch_slot_with_data","level":"INFO","line":833,"msg":"slot is processing task","slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438} {"function":"update_slots","ga_i":0,"level":"INFO","line":1819,"msg":"slot progression","n_past":0,"n_past_se":0,"n_prompt_tokens_processed":12,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438} {"function":"update_slots","level":"INFO","line":1843,"msg":"kv cache rm [p0, end)","p0":0,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705438} {"function":"print_timings","level":"INFO","line":276,"msg":"prompt eval time = 2535.21 ms / 12 tokens ( 211.27 ms per token, 4.73 tokens per second)","n_prompt_tokens_processed":12,"n_tokens_second":4.733339434081937,"slot_id":0,"t_prompt_processing":2535.208,"t_token":211.26733333333334,"task_id":9,"tid":"13712","timestamp":1714705443} {"function":"print_timings","level":"INFO","line":290,"msg":"generation eval time = 2561.01 ms / 8 runs ( 320.13 ms per token, 3.12 tokens per second)","n_decoded":8,"n_tokens_second":3.123766356333495,"slot_id":0,"t_token":320.126375,"t_token_generation":2561.011,"task_id":9,"tid":"13712","timestamp":1714705443} {"function":"print_timings","level":"INFO","line":299,"msg":" total time = 5096.22 ms","slot_id":0,"t_prompt_processing":2535.208,"t_token_generation":2561.011,"t_total":5096.219,"task_id":9,"tid":"13712","timestamp":1714705443} {"function":"update_slots","level":"INFO","line":1651,"msg":"slot released","n_cache_tokens":20,"n_ctx":2048,"n_past":19,"n_system_tokens":0,"slot_id":0,"task_id":9,"tid":"13712","timestamp":1714705443,"truncated":false} {"function":"log_server_request","level":"INFO","line":2744,"method":"POST","msg":"request","params":{},"path":"/completion","remote_addr":"127.0.0.1","remote_port":57122,"status":200,"tid":"22756","timestamp":1714705443}[GIN] 2024/05/03 - 08:34:03 | 200 | 5.1187818s | 127.0.0.1 | POST "/api/chat" ``` Is it some known issue or am I missing something? ### OS Windows ### GPU _No response_ ### CPU Intel ### Ollama version 0.1.33
GiteaMirror added the bug label 2026-04-12 12:52:55 -05:00
Author
Owner

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

Are any headers such as Host or Authorization being set?

<!-- gh-comment-id:2092053833 --> @jmorganca commented on GitHub (May 3, 2024): Are any headers such as `Host` or `Authorization` being set?
Author
Owner

@MaheshAwasare commented on GitHub (May 3, 2024):

image
No headers set.

<!-- gh-comment-id:2092054811 --> @MaheshAwasare commented on GitHub (May 3, 2024): ![image](https://github.com/ollama/ollama/assets/48666285/5cdbd150-0795-40a3-a816-b4cb3e951d18) No headers set.
Author
Owner

@MaheshAwasare commented on GitHub (May 3, 2024):

To rule out any possibility of my local environment (localhost) doing any problems, I tested by starting local server for one of my nodejs api. For that API I am getting successful responses

This is POST request
image

This is GET request

image

So I think something wrong with Ollama downloaded on local.

<!-- gh-comment-id:2092119556 --> @MaheshAwasare commented on GitHub (May 3, 2024): To rule out any possibility of my local environment (localhost) doing any problems, I tested by starting local server for one of my nodejs api. For that API I am getting successful responses This is POST request ![image](https://github.com/ollama/ollama/assets/48666285/bd231f9b-08ac-47c5-acf5-35e10cb00fc8) This is GET request ![image](https://github.com/ollama/ollama/assets/48666285/dbd522a6-99e3-43e9-a3b9-559f97967840) So I think something wrong with Ollama downloaded on local.
Author
Owner

@MaheshAwasare commented on GitHub (May 3, 2024):

I also tried with Powershell with given command in documentation and it works fine.

PS C:\Windows\system32> (Invoke-WebRequest -method POST -Body '{"model":"llama3", "prompt":"explain in 100 words, How GCD(concept from maths) is used in fractional data preprocessing?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json                                                                                   

model                : llama3
created_at           : 2024-05-03T05:07:14.7698499Z
response             : The Greatest Common Divisor (GCD) concept from mathematics is applied in fractional data
                      preprocessing to normalize and scale numerical features. When dealing with fractional data,
                      such as financial or scientific datasets, it's crucial to maintain the relationships between
                      variables while reducing their magnitudes. The GCD operation helps achieve this by identifying
                      the common denominators among fractions, allowing for consistent scaling. By dividing each
                      feature value by its corresponding GCD, the data is normalized without losing information. This
                      preprocessing step prepares the data for analysis, machine learning modeling, or visualization,
                      ensuring that features with different scales can be effectively compared and processed.
done                 : True
context              : {128006, 882, 128007, 198...}
total_duration       : 101202558100
load_duration        : 17252836400
prompt_eval_count    : 31
prompt_eval_duration : 9149489000
eval_count           : 123
eval_duration        : 74772468000
<!-- gh-comment-id:2092219776 --> @MaheshAwasare commented on GitHub (May 3, 2024): I also tried with Powershell with given command in documentation and it works fine. ``` PS C:\Windows\system32> (Invoke-WebRequest -method POST -Body '{"model":"llama3", "prompt":"explain in 100 words, How GCD(concept from maths) is used in fractional data preprocessing?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json model : llama3 created_at : 2024-05-03T05:07:14.7698499Z response : The Greatest Common Divisor (GCD) concept from mathematics is applied in fractional data preprocessing to normalize and scale numerical features. When dealing with fractional data, such as financial or scientific datasets, it's crucial to maintain the relationships between variables while reducing their magnitudes. The GCD operation helps achieve this by identifying the common denominators among fractions, allowing for consistent scaling. By dividing each feature value by its corresponding GCD, the data is normalized without losing information. This preprocessing step prepares the data for analysis, machine learning modeling, or visualization, ensuring that features with different scales can be effectively compared and processed. done : True context : {128006, 882, 128007, 198...} total_duration : 101202558100 load_duration : 17252836400 prompt_eval_count : 31 prompt_eval_duration : 9149489000 eval_count : 123 eval_duration : 74772468000 ```
Author
Owner

@Surrogard commented on GitHub (May 4, 2024):

@MaheshAwasare In the picture of the rest client you have set the content-type to "text/plain", change that to "application/json" for a test. I had to send this header in my client as well.

<!-- gh-comment-id:2094101121 --> @Surrogard commented on GitHub (May 4, 2024): @MaheshAwasare In the picture of the rest client you have set the content-type to "text/plain", change that to "application/json" for a test. I had to send this header in my client as well.
Author
Owner

@MaheshAwasare commented on GitHub (May 5, 2024):

@Surrogard , I tried with application/json as well it does not work. In fact I tried with application/json first and then changed to text/plain.

I also tried with different model (phi) and same issue is there. Please find both screenshots i.e. working with command line and not working with rest client.

  1. Working on command prompt
    image

  2. Not working on Rest Client
    image

<!-- gh-comment-id:2094836011 --> @MaheshAwasare commented on GitHub (May 5, 2024): @Surrogard , I tried with application/json as well it does not work. In fact I tried with application/json first and then changed to text/plain. I also tried with different model (phi) and same issue is there. Please find both screenshots i.e. working with command line and not working with rest client. 1. Working on command prompt ![image](https://github.com/ollama/ollama/assets/48666285/7d278c55-9587-4c72-acb3-01c407edf30d) 2. Not working on Rest Client ![image](https://github.com/ollama/ollama/assets/48666285/02bf1b01-6950-4001-a767-b4a438313568)
Author
Owner

@Surrogard commented on GitHub (May 5, 2024):

@MaheshAwasare
Well, if the Powershell one works fine, the error most probably must lie with the Rest Client.
If you want you can try the following bash script (in WSL if you don't have a linux) (curtesy of ollama model codeqwen):

#!/bin/bash

# Define the URL of the Ollama server
ollama_url="http://localhost:11434"

# Set the model name 
model="llava"

# Check if a prompt is provided as a parameter
if [ -z "$1" ]; then
  echo "Usage: $0 <prompt>"
  exit 1
fi

# Set the prompt from the parameter
prompt="$1"

# Set the options and prepare the body
body="{ \"model\": \"$model\", \"prompt\": \"$prompt\", \"stream\": false, \"options\":{ \"temperature\":0 } }"

# Send a POST request to the Ollama server with the model and prompt
response=$(curl -s -X POST "$ollama_url/api/generate" -H "Content-Type: application/json" -d "$body")

# Extract the response from the JSON object
response_text=$(echo $response | jq -r '.response')

# Print the response text
echo "$response_text"
<!-- gh-comment-id:2094859906 --> @Surrogard commented on GitHub (May 5, 2024): @MaheshAwasare Well, if the Powershell one works fine, the error most probably must lie with the Rest Client. If you want you can try the following bash script (in WSL if you don't have a linux) (curtesy of ollama model codeqwen): ```bash #!/bin/bash # Define the URL of the Ollama server ollama_url="http://localhost:11434" # Set the model name model="llava" # Check if a prompt is provided as a parameter if [ -z "$1" ]; then echo "Usage: $0 <prompt>" exit 1 fi # Set the prompt from the parameter prompt="$1" # Set the options and prepare the body body="{ \"model\": \"$model\", \"prompt\": \"$prompt\", \"stream\": false, \"options\":{ \"temperature\":0 } }" # Send a POST request to the Ollama server with the model and prompt response=$(curl -s -X POST "$ollama_url/api/generate" -H "Content-Type: application/json" -d "$body") # Extract the response from the JSON object response_text=$(echo $response | jq -r '.response') # Print the response text echo "$response_text" ```
Author
Owner

@MaheshAwasare commented on GitHub (May 6, 2024):

@Surrogard no WSL or linux on my machine. I am using windows.
But I tried samething from jupyter notebook and it worked.
image

I think most probably the error would be in handling request coming from REST client like Postman and HoppScotch

<!-- gh-comment-id:2095361602 --> @MaheshAwasare commented on GitHub (May 6, 2024): @Surrogard no WSL or linux on my machine. I am using windows. But I tried samething from jupyter notebook and it worked. ![image](https://github.com/ollama/ollama/assets/48666285/647d0938-af70-4149-aa75-018b11e1ca6d) I think most probably the error would be in handling request coming from REST client like Postman and HoppScotch
Author
Owner

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

I also have this problem using the RESTer client on firefox and macOS. Interestingly I was able to get a GET request to work: http://localhost:11434/api/tags. But with POST I get the 403 forbidden response. Did you ever figure out why?

<!-- gh-comment-id:2108943347 --> @peterfk commented on GitHub (May 13, 2024): I also have this problem using the RESTer client on firefox and macOS. Interestingly I was able to get a GET request to work: http://localhost:11434/api/tags. But with POST I get the 403 forbidden response. Did you ever figure out why?
Author
Owner

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

Here is the issue

curl http://localhost:11434/api/generate
-H "Origin: chrome-extension://bpoadfkcbjbfhfodiogcnhade..f"
-d '{
"model": "llama3",
"prompt": "Why is the sky blue?",
"stream": false
}'

If you add a Origin header you get the 403 response. Maybe the rest client is doing this by default. More info here:

https://github.com/ollama/ollama/issues/2425

I didn't really understand the fix though?

<!-- gh-comment-id:2108998299 --> @peterfk commented on GitHub (May 13, 2024): Here is the issue curl http://localhost:11434/api/generate \ -H "Origin: chrome-extension://bpoadfkcbjbfhfodiogcnhade..f" \ -d '{ "model": "llama3", "prompt": "Why is the sky blue?", "stream": false }' If you add a Origin header you get the 403 response. Maybe the rest client is doing this by default. More info here: https://github.com/ollama/ollama/issues/2425 I didn't really understand the fix though?
Author
Owner

@peterfk commented on GitHub (May 14, 2024):

These REST clients seem to set a lot of headers by default. For me the problem one was origin

Origin: moz-extension://e9e1ba1b-37f9-4d80-b97e-c3e2d9738009

The simplest fix is to change it to

Origin: http://localhost

Now my REST client is working as expected.

<!-- gh-comment-id:2111262672 --> @peterfk commented on GitHub (May 14, 2024): These REST clients seem to set a lot of headers by default. For me the problem one was origin Origin: moz-extension://e9e1ba1b-37f9-4d80-b97e-c3e2d9738009 The simplest fix is to change it to Origin: http://localhost Now my REST client is working as expected.
Author
Owner

@MaheshAwasare commented on GitHub (May 15, 2024):

Thanks for this input. In my case, I changed the REST client and it worked with other REST client.

<!-- gh-comment-id:2113052610 --> @MaheshAwasare commented on GitHub (May 15, 2024): Thanks for this input. In my case, I changed the REST client and it worked with other REST client.
Author
Owner

@faizzed commented on GitHub (Jul 27, 2024):

Set the ollama server CORS origins

Macos:

launchctl setenv OLLAMA_ORIGINS "*"

For other OS, read here https://medium.com/dcoderai/how-to-handle-cors-settings-in-ollama-a-comprehensive-guide-ee2a5a1beef0

<!-- gh-comment-id:2254177024 --> @faizzed commented on GitHub (Jul 27, 2024): Set the ollama server CORS origins Macos: ``` launchctl setenv OLLAMA_ORIGINS "*" ``` For other OS, read here https://medium.com/dcoderai/how-to-handle-cors-settings-in-ollama-a-comprehensive-guide-ee2a5a1beef0
Author
Owner

@ameysh commented on GitHub (Nov 25, 2024):

Following the Medium guide and setting the environment variable in Windows worked for me. Thanks a ton!

<!-- gh-comment-id:2499264703 --> @ameysh commented on GitHub (Nov 25, 2024): Following the Medium guide and setting the environment variable in Windows worked for me. Thanks a ton!
Author
Owner

@Rock48 commented on GitHub (Feb 5, 2025):

Set the ollama server CORS origins

Macos:

launchctl setenv OLLAMA_ORIGINS "*"

For other OS, read here https://medium.com/dcoderai/how-to-handle-cors-settings-in-ollama-a-comprehensive-guide-ee2a5a1beef0

omg thank you. Adding the extension to the variable didn't work but * worked flawlessly. Considering this is something only family and close friends are going to be using I'm ok with that.

<!-- gh-comment-id:2635623133 --> @Rock48 commented on GitHub (Feb 5, 2025): > Set the ollama server CORS origins > > Macos: > > ``` > launchctl setenv OLLAMA_ORIGINS "*" > ``` > > For other OS, read here https://medium.com/dcoderai/how-to-handle-cors-settings-in-ollama-a-comprehensive-guide-ee2a5a1beef0 omg thank you. Adding the extension to the variable didn't work but * worked flawlessly. Considering this is something only family and close friends are going to be using I'm ok with that.
Author
Owner

@valmayaki commented on GitHub (Aug 23, 2025):

I had a similar issue where I was using a local domain name on my pc and calling my Ollama server. Unless I set the Host header in the request to localhost, the ollama server always returns 403. It will only go through if the host header is either localhost, 127.0.0.1, or the hostname of my PC. This only happens when OLLAMA_HOST is bound to 127.0.0.1:11434.

I was using netsh to proxy requests from my windows pc local IP address to my Ollama server on my PC, which was running on 127.0.0.1:11434, not 0.0.0.0:111434

<!-- gh-comment-id:3216652507 --> @valmayaki commented on GitHub (Aug 23, 2025): I had a similar issue where I was using a local domain name on my pc and calling my Ollama server. Unless I set the Host header in the request to `localhost`, the ollama server always returns 403. It will only go through if the host header is either localhost, 127.0.0.1, or the hostname of my PC. This only happens when OLLAMA_HOST is bound to 127.0.0.1:11434. I was using netsh to proxy requests from my windows pc local IP address to my Ollama server on my PC, which was running on 127.0.0.1:11434, not 0.0.0.0:111434
Author
Owner

@Manikandan-c commented on GitHub (Nov 17, 2025):

For Windows Machine using "set OLLAMA_ORIGINS=*" in cmd prompt and re-start "ollama serve" will fix the issues

<!-- gh-comment-id:3543135713 --> @Manikandan-c commented on GitHub (Nov 17, 2025): For Windows Machine using "set OLLAMA_ORIGINS=*" in cmd prompt and re-start "ollama serve" will fix the issues
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2557