brettscott / cloudflare-worker-tunnel-mysql-example

Connect Cloudflare Worker to a self-hosted database via a secure Cloudflare Tunnel
Apache License 2.0
47 stars 3 forks source link

Similar Solution Viable For MSSQL? #3

Closed mark-mybaggage closed 6 months ago

mark-mybaggage commented 6 months ago

I understand this is for MySQL, however could this approach also work for MSSQL?

brettscott commented 6 months ago

Yes, this approach could work the same way with MSSQL.

You'll need to ensure the following headers are sent when you establish a connection to MSSQL requests.

You'll see that the MySQL connection has been modified to include the above headers in driver/mysql/index.js and workers-override.ts.

The values are passed into connect() within index.ts. This is the moment the MySQL server connection is established.

Should be pretty straight-forward.