Cloudflare tunnel looks for local service on port 8080 regardless of service configuration

When I attempt to access my local web server through a Cloudflare tunnel, it does not work because Cloudflare attempts to access my local (origin) service on port 8080, when in fact it is running in port 80.

My config file looks like this:

tunnel: <UUID>
credentials-file: <PATH>
ingress:
  - hostname: macmini.mydomain.com
    service: http://192.168.0.1:80
  - service: http_status:404

And the tunnel output looks like this:

2023-01-22T15:31:26Z ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused" connIndex=1 dest=https://macmini.mydomain.com/index.html ip=198.41.200.23 type=http

I can see in the tunnel output that it cannot reach the origin service at [::1]:8080. I want it to be trying at port 80 instead. If I configure Apache to listen on port 8080 (which I don’t want to do), all is well.

How I can I configure the tunnel so that it looks for my local (origin) service on port 80?

Thanks!

What command are you using to run the tunnel?

Windows or Linux? :thinking:

Might be your config.yml file is in wrong user directory.

Had the same issue recently at school.
I think it’s default set to 8080 somehow :thinking:
That way, I figured it out and fixed it by creating the .cloudflared directory and copy-paste config.yml inside my “local” user, instead of the “root”.

However, on other device, it works pretty fine at “root”.

Could you try that way?

Hi, and thank you for your help.

I am running the tunnel using the following command:

cloudflared tunnel run <my-tunnel-name>

I am running the tunnel on a Mac.

The config file is the .cloudflared subdirectory in my home directory, and I get the same result even if I specify it explicitly. Below, I show:

  1. the contents of ~/.cloudflared/config.yml, and
  2. the tunnel log illustrating that Cloudflare is still looking for my service on port 8080 instead of port 80.
$ cat ~/.cloudflared/config.yml 
tunnel: 1af5b8b9-3945-4ec3-946c-2ca081edc7f9
credentials-file: /Users/<my-username>/.cloudflared/1af5b8b9-3945-4ec3-946c-2ca081edc7f9.json
ingress:
  - hostname: macmini.<my-domain>.com
    service: http://192.168.0.1:80 
  - service: http_status:404
$ cloudflared tunnel --config ~/.cloudflared/config.yml run <my-tunnel-name>
... <snip!> ...
2023-01-25T20:40:45Z ERR  error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:8080: connect: connection refused" cfRay=78f3d364db9f0cc1-EWR originService=http://localhost:8080

Thank you very much for your attention and help!