Tunnel Error "Unable to reach the origin service"

Hello there everyone, I am very new to all this networking stuff so I will try and be as detailed as possible in regards to my issue. In short, I followed the documentation to setup the tunnel through the CLI interface. I am running this off a Virtual machine (Ubuntu 22.04.1 LTS). My server hosting this VM is a TrueNAS SCALE (TrueNAS-SCALE-22.02.3).

I got to the point where I am running the tunnel and trying to access my webpage through the domain name, but I am getting the Bad Gateway error on the webpage. When I look at my terminal in the VM I see the following:

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 (localhost):(port to my truenas application): connect: connection refused

Here is what my config(dot)yml looks like (anything inside brackets is a substitute for real info):

tunnel: (The UUID i get from the procedure)
credentials-file: /root/.cloudflared/(The UUID i get from the procedure)(dot)json
warp-routing:
enabled: true

ingress:

  • hostname: home(dot)(My Domain)
    service: http(colon)(//)localhost(colon)(port to my truenas application)
    originRequest:
    noTLSVerify: true

  • hostname: next(dot)(My Domain)
    service: http(colon)(//)localhost(colon)(port to my second truenas application)
    originRequest:
    noTLSVerify: true

  • service: http(_)status(colon)404

I am not sure what the origin service is so im finding it difficult to diagnose and most things I see online refer to the TLSVerify variable, which my config.yml takes care of. Perhaps Im missing/misunderstanding something? am I supposed to have an actual IP rather than localhost in the ingress? In which case is it the VM localhost or the truenas localhost?

What i would like to be able to do is launch nextcloud and home assistant remotly, and due to my unfamiliarity of networking this Cloudflare tunnel seems to be the safest option for me. Any help would be greatly appreciated.

Localhost would refer to the machine cloudflared is installed on but to make it less confusing can use the local ip address

Also make sure the protocol is correct (http vs https)

Maybe instead of localhost, go to the urls in your webbrowser and if it works copy them to the configuration.

Once it works you can switch to localhost again