Connection times out when using TCP protocol, HTTP works fine?

Hi, my postgres database which I want to connect to requires non HTTP (TCP) connections. I created a tunnel and set up a super simple express.js app and configured the tunnel to forward http requests to that server:

tunnel: x
credentials-file: /home/pi/.cloudflared/x.json

ingress:
  - hostname: my.cool.subdomain
    service: http://localhost:3000
  - service: http_status:404

That worked fine and as expected.
But when configuring TCP like this:

ingress:
  - hostname: my.cool.subdomain
    service: tcp://localhost:17559
  - service: http_status:404

The connection times out.
I checked that the database is accessible via the local network. When I directly connect via the local network it works. The ufw on the machine itself is disabled.

Is my configuration correct? Thanks in advance!

My rough understanding of cloudflared is that it only listens on a few ports.

My Ingress rule for HTTP certainly listens on the regular HTTP/S ports on the :orange: Proxied hostname.
But my Ingress Rule for SSH probably listens on 7844. So I proxy my SSH connection through cloudflared on my Mac so it can tunnel through to my server.

My PiHole is similar. Cloudflared on my Pi listens for PiHole requests on 5053, then proxies DoH through cloudflared.

Point being that if it’s not web traffic, I’m pretty sure you have to tunnel that traffic locally with Cloudflared.

1 Like

When using the tcp ingress rule, how are you accessing that Tunnel?

You should be using the method A) that I refer to in Cloudflare Access (You do not have permission) - Tunnel Issue - #2 by nuno.diegues

Or alternatively set up WARP to Tunnel as referred to in B) in that link

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.