[GH-ISSUE #3215] Access Denied Using LocalTunnel or Ngrok #1982

Closed
opened 2026-04-12 12:10:24 -05:00 by GiteaMirror · 12 comments
Owner

Originally created by @Sonali-Behera-TRT on GitHub (Mar 18, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3215

What is the issue?

I am unable to access my Ollama server locally using LocalTunnel or Ngrok. When attempting to access the server through the provided URL, I receive a 403 Forbidden error message.

I am using Ollama on Colab/Kaggle to utilize free GPU access. Ollama operates within a containerized environment on Colab/Kaggle, making it impossible to access its endpoint directly from the notebook. Thus, I must tunnel the local Ollama server address to the internet for external access. The steps outlined below were functioning flawlessly until three days ago when they started throwing an error: Access to silent-lamps-hang.loca.lt was denied. You don't have authorization to view this page. HTTP ERROR 403. I am unable to troubleshoot this issue. Subsequently, I attempted the same steps locally without reinstalling Ollama, as I had previously downloaded it. I executed only steps 3 and 4 from the "Steps to reproduce" section, which worked without any issues. However, upon executing all the steps as listed below, the aforementioned error resurfaced.

I suspect that the error may be due to a new version replacing the old one on my system.

I tried different tunneling methods like LocalTunnel and Ngrok.Both gave the same error, but they work for other tunneling cases except ollama.

Any assistance in resolving this matter would be greatly appreciated!

What did you expect to see?

I expect to access the Ollama server interface at the given URL after establishing the tunnel. It should display Ollama is running similar to the default endpoint http://localhost:11434.

Steps to reproduce

In Kaggle/Colab Notebook:

  1. Start a fresh notebook.
  2. Copy and paste the following commands into separate cells:
    • !curl https://ollama.ai/install.sh | sh
    • !ollama
    • !curl https://ipv4.icanhazip.com/ (This retrieves your IP address)
    • !ollama serve & npx localtunnel -p 11434 (Starts Ollama server and creates a tunnel)
  3. Run all the commands in the cells.
  4. Access Instructions:
    • The output from step 4 will provide a URL. Open this URL in a new browser tab.
    • In the new browser tab, locate the "Tunnel Password" field (specific wording might vary depending on the tunneling tool).
    • Copy the IP address obtained in step 3 and paste it into the "Tunnel Password" field.

Locally (Using Terminal):

  1. Open your terminal application.
  2. Execute the following commands one by one:
    • curl https://ollama.ai/install.sh | sh
    • ollama
    • curl https://ipv4.icanhazip.com/ (This retrieves your IP address)
    • ollama serve & npx localtunnel -p 11434 (Starts Ollama server and creates a tunnel)
  3. Access Instructions:
    • Similar to the Colab steps, the output from step 4 will provide a URL. Open this URL in a new browser tab.
    • Locate the "Tunnel Password" field in the new browser tab and paste the IP address from step 3 into it.

Are there any recent changes that introduced the issue?

This access issue started after I downloaded and installed the latest version of Ollama (v0.1.29). Previously, with an earlier version, I was able to access the server successfully using LocalTunnel or Ngrok.

OS

Linux

Architecture

x86

Platform

No response

Ollama version

0.1.29

GPU

Nvidia

GPU info

  1. In Kaggle, I am using GPU T4X2. Details are below
Mon Mar 18 07:39:04 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.129.03             Driver Version: 535.129.03   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Tesla T4                       Off | 00000000:00:04.0 Off |                    0 |
| N/A   56C    P8              10W /  70W |      0MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  Tesla T4                       Off | 00000000:00:05.0 Off |                    0 |
| N/A   57C    P8              10W /  70W |      0MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
  1. In Colab, I am using the T4 GPU. Below are the details
Mon Mar 18 07:42:13 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Tesla T4                       Off | 00000000:00:04.0 Off |                    0 |
| N/A   54C    P8               9W /  70W |      0MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
  1. For local environment, I do not use any GPU. Only CPU is used.

CPU

Intel

Other software

No response

Originally created by @Sonali-Behera-TRT on GitHub (Mar 18, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3215 ### What is the issue? I am unable to access my Ollama server locally using LocalTunnel or Ngrok. When attempting to access the server through the provided URL, I receive a `403 Forbidden` error message. I am using Ollama on Colab/Kaggle to utilize free GPU access. Ollama operates within a containerized environment on Colab/Kaggle, making it impossible to access its endpoint directly from the notebook. Thus, I must tunnel the local Ollama server address to the internet for external access. The steps outlined below were functioning flawlessly until three days ago when they started throwing an error: `Access to silent-lamps-hang.loca.lt was denied. You don't have authorization to view this page. HTTP ERROR 403`. I am unable to troubleshoot this issue. Subsequently, I attempted the same steps locally without reinstalling Ollama, as I had previously downloaded it. I executed only steps `3` and `4` from the "Steps to reproduce" section, which worked without any issues. However, upon executing all the steps as listed below, the aforementioned error resurfaced. I suspect that the error may be due to a new version replacing the old one on my system. I tried different tunneling methods like LocalTunnel and Ngrok.Both gave the same error, but they work for other tunneling cases except ollama. Any assistance in resolving this matter would be greatly appreciated! ### What did you expect to see? I expect to access the Ollama server interface at the given URL after establishing the tunnel. It should display `Ollama is running` similar to the default endpoint `http://localhost:11434`. ### Steps to reproduce In Kaggle/Colab Notebook: 1. Start a fresh notebook. 2. Copy and paste the following commands into separate cells: - `!curl https://ollama.ai/install.sh | sh` - `!ollama` - `!curl https://ipv4.icanhazip.com/` (This retrieves your IP address) - `!ollama serve & npx localtunnel -p 11434` (Starts Ollama server and creates a tunnel) 3. Run all the commands in the cells. 4. Access Instructions: - The output from step 4 will provide a URL. Open this URL in a new browser tab. - In the new browser tab, locate the "Tunnel Password" field (specific wording might vary depending on the tunneling tool). - Copy the IP address obtained in step 3 and paste it into the "Tunnel Password" field. Locally (Using Terminal): 1. Open your terminal application. 2. Execute the following commands one by one: - `curl https://ollama.ai/install.sh | sh` - `ollama` - `curl https://ipv4.icanhazip.com/` (This retrieves your IP address) - `ollama serve & npx localtunnel -p 11434` (Starts Ollama server and creates a tunnel) 3. Access Instructions: - Similar to the Colab steps, the output from step 4 will provide a URL. Open this URL in a new browser tab. - Locate the "Tunnel Password" field in the new browser tab and paste the IP address from step 3 into it. ### Are there any recent changes that introduced the issue? This access issue started after I downloaded and installed the latest version of Ollama (v0.1.29). Previously, with an earlier version, I was able to access the server successfully using LocalTunnel or Ngrok. ### OS Linux ### Architecture x86 ### Platform _No response_ ### Ollama version 0.1.29 ### GPU Nvidia ### GPU info 1. In Kaggle, I am using GPU T4X2. Details are below ``` Mon Mar 18 07:39:04 2024 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.129.03 Driver Version: 535.129.03 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 | | N/A 56C P8 10W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ | 1 Tesla T4 Off | 00000000:00:05.0 Off | 0 | | N/A 57C P8 10W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ +---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ ``` 2. In Colab, I am using the T4 GPU. Below are the details ``` Mon Mar 18 07:42:13 2024 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 | | N/A 54C P8 9W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ +---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ ``` 3. For local environment, I do not use any GPU. Only CPU is used. ### CPU Intel ### Other software _No response_
GiteaMirror added the bug label 2026-04-12 12:10:24 -05:00
Author
Owner

@jmorganca commented on GitHub (Mar 18, 2024):

Hi there, I've added an FAQ entry on using Ollama with Ngrok: https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-use-ollama-with-ngrok

Hope this helps!

<!-- gh-comment-id:2003291853 --> @jmorganca commented on GitHub (Mar 18, 2024): Hi there, I've added an FAQ entry on using Ollama with Ngrok: https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-use-ollama-with-ngrok Hope this helps!
Author
Owner

@Sonali-Behera-TRT commented on GitHub (Mar 18, 2024):

Thank you. It worked:)

<!-- gh-comment-id:2003320531 --> @Sonali-Behera-TRT commented on GitHub (Mar 18, 2024): Thank you. It worked:)
Author
Owner

@Anindyait commented on GitHub (Mar 18, 2024):

Found a way for installing older Ollama versions here https://github.com/ollama/ollama/issues/2491

curl -fsSL https://ollama.com/install.sh | sed 's#https://ollama.com/download#https://github.com/jmorganca/ollama/releases/download/v0.1.27#' | sh

Now works fine in collab with ngrok.

<!-- gh-comment-id:2004639079 --> @Anindyait commented on GitHub (Mar 18, 2024): Found a way for installing older Ollama versions here [https://github.com/ollama/ollama/issues/2491](https://github.com/ollama/ollama/issues/2491) `curl -fsSL https://ollama.com/install.sh | sed 's#https://ollama.com/download#https://github.com/jmorganca/ollama/releases/download/v0.1.27#' | sh` Now works fine in collab with ngrok.
Author
Owner

@Sonali-Behera-TRT commented on GitHub (Mar 19, 2024):

Thank you @Anindyait! It works perfectly with older versions.

<!-- gh-comment-id:2005813623 --> @Sonali-Behera-TRT commented on GitHub (Mar 19, 2024): Thank you @Anindyait! It works perfectly with older versions.
Author
Owner

@michael-williams-mwa commented on GitHub (Mar 19, 2024):

For Google Colab, I added '--host-header="localhost:11434"' to the asyncio.gather function and it worked for me.

await asyncio.gather(
run_process(['ollama', 'serve']),
run_process(['ngrok', 'http', '--log', 'stderr', '11434', '--host-header="localhost:11434"']),
)

<!-- gh-comment-id:2007741819 --> @michael-williams-mwa commented on GitHub (Mar 19, 2024): For Google Colab, I added '--host-header="localhost:11434"' to the asyncio.gather function and it worked for me. await asyncio.gather( run_process(['ollama', 'serve']), run_process(['ngrok', 'http', '--log', 'stderr', '11434'```, '--host-header="localhost:11434"'```]), )
Author
Owner

@Sonali-Behera-TRT commented on GitHub (Mar 20, 2024):

Thanks for sharing! @michael-williams-mwa

<!-- gh-comment-id:2008642292 --> @Sonali-Behera-TRT commented on GitHub (Mar 20, 2024): Thanks for sharing! @michael-williams-mwa
Author
Owner

@mrbeandev commented on GitHub (May 8, 2024):

ngrok http 11434 --host-header="localhost:11434"

this works

<!-- gh-comment-id:2099549251 --> @mrbeandev commented on GitHub (May 8, 2024): `ngrok http 11434 --host-header="localhost:11434"` this works
Author
Owner

@mrsniperz commented on GitHub (May 28, 2024):

For Google Colab, I added '--host-header="localhost:11434"' to the asyncio.gather function and it worked for me.

await asyncio.gather( run_process(['ollama', 'serve']), run_process(['ngrok', 'http', '--log', 'stderr', '11434', '--host-header="localhost:11434"']), )

Thanks a lot, it works.

<!-- gh-comment-id:2134572851 --> @mrsniperz commented on GitHub (May 28, 2024): > For Google Colab, I added '--host-header="localhost:11434"' to the asyncio.gather function and it worked for me. > > await asyncio.gather( run_process(['ollama', 'serve']), run_process(['ngrok', 'http', '--log', 'stderr', '11434'`, '--host-header="localhost:11434"'`]), ) Thanks a lot, it works.
Author
Owner

@HyperUpscale commented on GitHub (Jun 5, 2024):

It is not about ollama, but rather the command to start ngrok:

Latest:
ollama version is 0.1.41 on Windows

the tunnel works with
just replace this subdomain

                               |    
                              \ /
                   ︵︵︵︵︵︵︵︵︵︵︵︵
                  |        replace       |

ngrok http --domain=ASSIGNED-FREE-SUBDOMAIN.ngrok-free.app 11434 --host-header="http://localhost:11434"

<!-- gh-comment-id:2150107880 --> @HyperUpscale commented on GitHub (Jun 5, 2024): It is not about ollama, but rather the command to start ngrok: Latest: ollama version is 0.1.41 on Windows the tunnel works with just **replace** this subdomain ``` | \ / ︵︵︵︵︵︵︵︵︵︵︵︵ | replace | ``` `ngrok http --domain=ASSIGNED-FREE-SUBDOMAIN.ngrok-free.app 11434 --host-header="http://localhost:11434"`
Author
Owner

@gblikas commented on GitHub (Sep 15, 2024):

Hi there, I've added an FAQ entry on using Ollama with Ngrok: https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-use-ollama-with-ngrok

Hope this helps!

This worked, but I haven't had to do this with local servers before. Could you explain why the --host-headers command is needed?

<!-- gh-comment-id:2351239152 --> @gblikas commented on GitHub (Sep 15, 2024): > Hi there, I've added an FAQ entry on using Ollama with Ngrok: https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-use-ollama-with-ngrok > > Hope this helps! This worked, but I haven't had to do this with local servers before. Could you explain why the `--host-headers` command is needed?
Author
Owner

@MayaMua commented on GitHub (Dec 12, 2024):

If you are using agent with tunnels, have the config below in your ngrok.yml:

version: "3"
agent:
  authtoken: 
tunnels:
  ollama:
    addr: 11434
    proto: http
    request_header:
      add: ["Host: localhost:11434"]

It works for me.
Please let me know if the config doesn't work for you.

<!-- gh-comment-id:2537679713 --> @MayaMua commented on GitHub (Dec 12, 2024): If you are using agent with tunnels, have the config below in your ngrok.yml: ``` version: "3" agent: authtoken: tunnels: ollama: addr: 11434 proto: http request_header: add: ["Host: localhost:11434"] ``` It works for me. Please let me know if the config doesn't work for you.
Author
Owner

@carlosananias commented on GitHub (Apr 8, 2026):

ngrok http 11434 --host-header="localhost:11434"

this works

It works for me!! Tks

<!-- gh-comment-id:4206697474 --> @carlosananias commented on GitHub (Apr 8, 2026): > `ngrok http 11434 --host-header="localhost:11434"` > > this works It works for me!! Tks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1982