redirect spesific IP request with port 3306

how to redirect spesific IP request with port 3306 in cloudflare to another server IP with port 3306

If the request is via an IP address and doesn’t use a domain name, it goes direct to the server and not through Cloudflare.

Even if it is using a domain name, the proxy only supports HTTP/HTTPS (not database protocols that are typical on port 3306) and only on these ports…

1 Like

Hi,
The request is not for an IP, and its for a domain that is managed on Cloudflare.

$host = ‘mydomain.con:3306’;
$user = ‘user1’;
$pass = ‘1234’;
$dbname = ‘DB_NAME’;

My question was how I transfer the user that came, for example, from this IP: 5.5.5.5, and he wants to connect to mydomain.com:3306 and i want to transfer only this IP request to mydomain2.com:3306

i try to do it with Redirect Rules

prnt.sc/Ug504Rdp0oeY

but i understand it only for port 80 and not for 3306.

mydomain.com and mydomain2.com are both managed with my cloudflare account

You can’t do that, redirects are a feature of the HTTP protocol.

The only way to do it on Cloudflare (assuming your domain names are also used for a website and other things so you can’t just change the IP addresses in the DNS), is to use Cloudflare Spectrum to proxy port 3306 packets for mydomain.com and forward them to the IP address of the server for mydomain2.com. But that’s an add-on to an Enterprise plan so likely too expensive for your use case.

1 Like

You could also proxy connections to your database via Cloudflare Tunnel.

1 Like