"The requested address is not valid" error when connect RDP using IP address

Related to

Cloudflare Tunnel

What is the error message?

ERR Error on Websocket listener error=“failed to start forwarding server: listen tcp 192.168.68.50:3389: bind: The requested address is not valid in its context.” failed to start forwarding server: listen tcp 192.168.68.50:3389: bind: The requested address is not valid in its context.

What is the issue you’re encountering

I host my tunnel on a linux machine, and want to access another Windows PC in my LAN remotely by RDP. I set up public hostnames for the Windows (rdp-a.domain.com) using IP:3389 as the url. When I try to start cloudflared from remote computer, it shows me the error message “The requested address is not valid in its context.” and of course the RDP doesn’t work. Then I change the public hostname url to “localhost:3389”, then I was able to run cloudflared with no error, but still can’t establish RDP connection. To my understanding, this “localhost” actually refers to the Linux host, not the Windows PC. My question is, why is the IP address not working here? And is it possible to set up a separate tunnel on the Windows PC, and set public hostname using “localhost” instead of IP? Are those two tunnels actually the same one?

What steps have you taken to resolve the issue?

I followed this document: RDP | Cloudflare Zero Trust docs

Screenshot of the error