Connect Ollama to Your Browser: Setup & CORS Fix
PageGrok talks to Ollama over its local HTTP API. On most machines it works out of the box — install Ollama, pull a model, and PageGrok finds it immediately. This guide covers the full setup and the one thing that can go wrong: CORS.
Install Ollama
Download from ollama.com and run the installer.
- macOS: Download the .dmg, or
brew install ollama - Windows: Download the installer from the website
- Linux:
curl -fsSL https://ollama.com/install.sh | sh
After installation, verify it works:
ollama --version
Pull a model
Pick a model from ollama.com/search and pull it:
ollama pull gemma4
Popular choices for browser reading tasks:
gemma4— fast, well-roundedqwen3.5— strong multilingualmistral-small— compact and efficientdeepseek-r1— good for reasoning-heavy pages
Not sure which your machine can handle? Check canirun.ai.
Start the server
ollama serve
This starts the API on http://127.0.0.1:11434. You can verify it is running:
curl http://127.0.0.1:11434
You should see Ollama is running.
On macOS, if you installed the desktop app, launching it from Applications starts the server automatically — look for the Ollama icon in the menu bar.
Connect PageGrok
- Install PageGrok from the Chrome Web Store
- Open any webpage and click the PageGrok icon
- Your Ollama models appear in the model selector automatically
That’s it for most users. If the model list is empty or you see an error, read the CORS section below.
Fix CORS errors
Chrome extensions send requests from chrome-extension:// origins. Ollama needs to be told that this origin is allowed.
When do you need this? Recent Ollama versions (0.5+) handle extension requests by default. You only need to set CORS if PageGrok shows “Failed to connect” or “CORS error”.
macOS / Linux
Set the environment variable before starting Ollama:
OLLAMA_ORIGINS="chrome-extension://*" ollama serve
To make it permanent, add to your shell profile (~/.zshrc or ~/.bashrc):
export OLLAMA_ORIGINS="chrome-extension://*"
If Ollama runs as a systemd service on Linux:
sudo systemctl edit ollama
Add under [Service]:
Environment="OLLAMA_ORIGINS=chrome-extension://*"
Then restart:
sudo systemctl restart ollama
Windows
Set the environment variable in System Settings → Environment Variables, or in PowerShell:
$env:OLLAMA_ORIGINS = "chrome-extension://*"
ollama serve
Verify CORS is working
After setting OLLAMA_ORIGINS, restart Ollama and check:
curl -I -H "Origin: chrome-extension://test" http://127.0.0.1:11434/api/tags
The response should include Access-Control-Allow-Origin. If it does, PageGrok will connect.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| “Connection refused” | Ollama is not running | Run ollama serve or launch the desktop app |
| “CORS error” or “Failed to fetch” | Extension origin blocked | Set OLLAMA_ORIGINS=chrome-extension://* and restart |
| Model list is empty | No models pulled | Run ollama pull <model> |
| Very slow first response | Model loading into memory | Wait 10–30 seconds on first question after a pause |
| “Model not found” | Model name typo or not pulled | Check ollama list for exact names |
Using a remote Ollama server
If you run Ollama on another machine (a GPU workstation, a home server), you can point PageGrok at it:
- On the remote machine, start Ollama with:
OLLAMA_HOST=0.0.0.0 OLLAMA_ORIGINS="chrome-extension://*" ollama serve
- In PageGrok settings, change the endpoint to
http://<remote-ip>:11434
Make sure port 11434 is open on the remote machine’s firewall. Data travels over your local network — if the remote machine is on a different network, use a VPN or SSH tunnel for security.
FAQ
Why does PageGrok say 'connection refused'?
Ollama is not running. Open a terminal and run `ollama serve`, then retry. If you installed Ollama as a desktop app on macOS, make sure the Ollama icon appears in the menu bar — that means the server is active.
What is OLLAMA_ORIGINS and why do I need it?
OLLAMA_ORIGINS is an environment variable that tells Ollama which origins are allowed to make cross-origin requests. Chrome extensions run from chrome-extension:// URLs, which Ollama blocks by default. Setting OLLAMA_ORIGINS=chrome-extension://* allows extensions like PageGrok to connect.
Do I need OLLAMA_ORIGINS if I use PageGrok?
On most systems, no. Recent versions of Ollama (0.5+) allow localhost requests from browser extensions by default. You only need to set OLLAMA_ORIGINS if you see a CORS error in the PageGrok panel.
Can I use a remote Ollama server?
Yes. In PageGrok settings, change the API endpoint from http://127.0.0.1:11434 to your remote server address. The remote Ollama instance must have OLLAMA_HOST=0.0.0.0 and appropriate OLLAMA_ORIGINS set.
Try it on the page you are reading right now
PageGrok connects your local models to any browser tab. Free, private, no sign-up.
Related guides
- Local AI in the Browser: Run Ollama and Chat With Any Webpage — Connect local models from Ollama, LM Studio, or oMLX to the page you are reading. Setup, model recommendations, real limits, and guides for specific reading tasks.
- Use LM Studio With a Browser Extension: Setup Guide — Connect LM Studio's local AI server to a Chrome extension. How to start the local server, configure the endpoint, and switch between LM Studio and Ollama.