Cloudflare tcp tunnel mysql db

What is the name of the domain?

https://usat-db.kidderwise.org

What is the error number?

2025-01-10T23:16:21Z ERR failed to connect to origin error=“websocket: bad handshake” originURL=https://usat-db.kidderwise.org

What is the error message?

2025-01-10T23:16:21Z ERR failed to connect to origin error=“websocket: bad handshake” originURL=https://usat-db.kidderwise.org

What is the issue you’re encountering

Tunnel is Listening but handshake issue when attempt to connect via mysql workbench

What are the steps to reproduce the issue?

Unknow root cause thus unknown.

Here’s a little more info.

  • Installed via “winget install --id Cloudflare.cloudflared”
  • Verified intall “where cloudflared” & “cloudflared --version”
  • cloudflared login process was successful
  • start tcp connection was successful
    • cloudflared access tcp --hostname [usat-db.kidderwise.org](http://usat-db.kidderwise.org) --url localhost:3307
    • success message 2025-01-10T23:16:12Z INF Start Websocket listener host=localhost:3308
  • attempted to connect via mysql workbench via 127.0.0.1, 3308, .
    • connection failed
    • error in terminal = 2025-01-10T23:16:21Z ERR failed to connect to origin error="websocket: bad handshake" originURL=https://usat-db.kidderwise.org

Steps to Resolve - None worked:

  • installed mysql server. worth a try. didn’t solve issue
  • checked all steps above. didn’t solve issue
  • checked against working version. didn’t solve issue
  • noted this link and followed steps. couldn’t locate the enable websocket feature in cloudflare dash
  • removed all access rules in cloudflare tunnel dashboard

I am afraid not possible to 3306 over a proxied :orange: hostname (sub-domain in your case). Cloudflare Tunnels use Cloudflare’s proxy, which only supports proxying HTTP(S) Traffic. Otherwise, you have to use Arbitrary TCP for such case.

Furthermore, do you need connections to the database or to manage it? If you’d need to manage it, then you can install and configure phpMyAdmin with a lightweight web server and bound it to a HTTP(S) port to the localhost to manage database(s).

I appreciate the info but I’m not sure I understand. I have this working and there are instructions on the internet that show it works. In my case it’s working on one client connected to the server via the cloudflared tunnel and not working on another.

On both sides, server and client A and client B the WARP is installed successfully and running? :thinking:

Hello -

  • Client A tunnel established, connects to Server A via cloudflared commanded noted above and mysql workbench as noted above.

  • Client B tunnel established, connects to Server A via cloudflared commanded noted above but mysql workbench fails as noted above.

Same process to setup for Client A and Client B noted as above.

Thank you for feedback.

On the 2nd one, is it the same installation and setup?

No firewall configured or that something might be blocking it?

Wonder if you can have the same login for 2 clients at the same time (despite it shouldn’t cause an issue) connected. Are you using the same or different credentials and user for both WARP and MySQL DB? :thinking:

Did you limited connections in your MySQL configuration file?

Hello - Good trouble shoot.

a) Not identical setup. 2nd computer is a co-worker machine so can’t guarantee idential.
b) Firewall = good point. I’ll have do some discovery here.
c) SQL = using same tcp setup (which should be an issue) and same credentials (same). Will test on another computer that I have control over to see if I can connect on both at the same time without issue. using the same login / credentials on boht initially to eliminate this as an issue.
d) Cloudflared tunnel = different installation… meaning different computers have individual installs but used the same install process as noted above on both.

The idea to test on another machine in my control and to check firewall issues on Client B are promising.

typos…