Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I sometimes got 403 error when i ask question from internet. #308

Open
zsw12abc opened this issue Jan 27, 2025 · 9 comments
Open

I sometimes got 403 error when i ask question from internet. #308

zsw12abc opened this issue Jan 27, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@zsw12abc
Copy link

Image

Image
My Ollama is hosted on my NAS via docker, (192.168.31.254)
and the Ollama port is same as the default one http://192.168.31.254:11434/

but still got 403 errors
the environment variable already added in the Ollama.

@n4ze3m
Copy link
Owner

n4ze3m commented Jan 27, 2025

Hey, sorry about the issue. Can you enable the custom origin header under Advanced Settings in Settings > Ollama Settings? This should hopefully resolve the issue, as Ollama seems to have a CORS issue.

@n4ze3m n4ze3m added the bug Something isn't working label Jan 27, 2025
@continue-revolution
Copy link

It seems that whenever we chat with deepseek for the second time in a chat history, we always get 403 no matter what, even if enabling custom origin header.

@n4ze3m
Copy link
Owner

n4ze3m commented Jan 27, 2025

The 403 issue in Ollama occurs due to a CORS problem, as described in this ollama/ollama#2335. Page Assist attempts to resolve it by rewriting headers, but unfortunately, this doesn't always work in certain browsers. #45 #308

Browser APIs often change with different releases, and since using web search is causing issues, I believe there is a bug in the origin header that is not being overridden. I will look into it.

The only current reliable solution is to add the following environment variable:

OLLAMA_ORIGINS=*

Steps to Add the Environment Variable

On Windows

  1. Press Win + S and search for Environment Variables.
  2. Open Edit the system environment variables.
  3. In the System Properties window, click on Environment Variables.
  4. Under System variables, click New.
    • Variable name: OLLAMA_ORIGINS
    • Variable value: *
  5. Click OK to save the changes.
  6. Restart Ollama.

On Mac

  1. Open the Terminal.
  2. Edit your shell configuration file:
    • For Bash: nano ~/.bash_profile
    • For Zsh (default on newer macOS): nano ~/.zshrc
  3. Add the following line at the end of the file:
    export OLLAMA_ORIGINS=*
    
  4. Save the file (Ctrl + O, then Enter, and Ctrl + X).
  5. Run source ~/.bash_profile or source ~/.zshrc to apply the changes.
  6. Restart Ollama.

On Linux

  1. Open the Terminal.
  2. Edit your shell configuration file:
    • For Bash: nano ~/.bashrc
    • For Zsh: nano ~/.zshrc
  3. Add the following line at the end of the file:
    export OLLAMA_ORIGINS=*
    
  4. Save the file (Ctrl + O, then Enter, and Ctrl + X).
  5. Run source ~/.bashrc or source ~/.zshrc to apply the changes.
  6. Restart Ollama.

This should resolve the issue. Hopefully, it works!

@continue-revolution
Copy link

continue-revolution commented Jan 27, 2025

I am on manjaro (zsh) with chrome. I did not permanently change zshrc. instead, I type export OLLAMA_ORIGINS=* then run ollama run deepseek-r1:32b , the 403 problem still exists. Then I tried running OLLAMA_ORIGINS=chrome-extension://* ollama run deepseek-r1:32b, the 403 problem still exists.

I guess it's not @n4ze3m 's bug. Instead, there could be some issue with my browser or ollama.

@n4ze3m
Copy link
Owner

n4ze3m commented Jan 27, 2025

Oh, that’s bad. Did you restart the Ollama?

try

OLLAMA_ORIGINS=* ollama serve

@continue-revolution
Copy link

It turned out that by running OLLAMA_ORIGINS=* ollama serve, it works properly. Thank you very much for your help

@odysseyalive
Copy link

There's another thing to remember, too. Google's search API is free to use. Half the time, Google doesn't return subsequent results--most likely due to resource monitoring per IP. So Page Assit might need to catch those failed API calls and retry.

@yCoffeeGames
Copy link

The keywords in Settings > RAG Settings > Prompt > Web does not fit the deepseek-r1 models well. After the first search on internet, large portion of the chat_history will be included in the search query sent to search engines. This causes the search engine to return errors (depending on search engine) and break the chat.

I tried many new keywords, but they are not working very well unless I delete the {chat_history}

Image

Image

@n4ze3m
Copy link
Owner

n4ze3m commented Jan 31, 2025

Yeah, the current follow-up query generation isn't really great using R1. I think I'll add an option to choose another model for generating follow-up questions or add a setting to turn off follow-up question generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants