Tunnel Query
Description
Section titled “Description”The Tunnel Query node runs SQL queries against a remote MySQL database you cannot reach directly — the typical shared hosting where the MySQL port is closed and there is no VPN. Instead of connecting to port 3306, it sends the query over HTTPS to a tunnel.php file on that hosting, which runs it locally with PDO prepared statements.
It supports dynamic variables in the query ({{field}}, {{@NodeName.field}}, {{#N.field}}, {{var.name}}), so you can automate PHP/WordPress/WooCommerce sites on cheap hosting without exposing the database.
Setup first: to create and install your
tunnel.php, follow the Tunnel Connector guide — it includes a wizard that generates your configuration.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Tunnel credential (tunnel.php URL + shared secret) |
| query | code | Yes | SQL query to execute (supports {{variable}}) |
| database | text | No | Overrides the tunnel’s default database (multi-tenant, X-Tenant-DB header) |
Credentials
Section titled “Credentials”Credential type tunnel, with:
- url: full URL of your
tunnel.php(e.g.https://your-domain.com/floogos/tunnel.php) - secret: shared secret, ≥32 characters (matches
TUNNEL_SECRETintunnel.config.php) - database: (optional) default database
Output
Section titled “Output”{ "nextModule": null, "data": [ { "id": 1, "name": "Example", "email": "test@test.com" } ], "_meta": { "success": true, "rowCount": 1, "insertId": null }}Usage Example
Section titled “Usage Example”{ "credentials_id": 1, "query": "SELECT * FROM orders WHERE status = 'pending' LIMIT 100"}With dynamic variables:
{ "credentials_id": 1, "query": "INSERT INTO customers (name, email) VALUES ('{{name}}', '{{email}}')"}- Variables
{{field}}become positional?placeholders and are sent asparams(prepared statements) — never string interpolation. - The tunnel allows SELECT / INSERT / UPDATE; DELETE only on whitelisted tables; DROP / ALTER / TRUNCATE / CREATE / GRANT and multi-statements are blocked; dangerous keywords (
INTO OUTFILE,LOAD_FILE,SLEEP,BENCHMARK,mysql.user) are rejected. - Uses HTTPS (
axios) with a configurable timeout (default 15000 ms). - A
403usually means a wrong secret or an IP not allowed by the tunnel.
Related Nodes
Section titled “Related Nodes”- MySQL Query — direct MySQL connection
- HTTP Request — generic HTTP requests