From 382873dc116002d89118d13b615d74ab9d8aaa14 Mon Sep 17 00:00:00 2001
From: jj <log@riseup.net>
Date: Sat, 2 Nov 2024 09:59:48 +0000
Subject: [PATCH] api/core: fix main cluster being unable to handle itunnels

---
 api/src/core/api.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/api/src/core/api.js b/api/src/core/api.js
index 5ea75c37..153f2ca6 100644
--- a/api/src/core/api.js
+++ b/api/src/core/api.js
@@ -8,7 +8,7 @@ import jwt from "../security/jwt.js";
 import stream from "../stream/stream.js";
 import match from "../processing/match.js";
 
-import { env, setTunnelPort } from "../config.js";
+import { env, isCluster, setTunnelPort } from "../config.js";
 import { extract } from "../processing/url.js";
 import { Green, Bright, Cyan } from "../misc/console-text.js";
 import { hashHmac } from "../security/secrets.js";
@@ -378,7 +378,7 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
         }
     });
 
-    if (!isPrimary) {
+    if (isCluster) {
         const istreamer = express();
         istreamer.get('/itunnel', itunnelHandler);
         const server = istreamer.listen({