From 1dfdfcfeec03178c48a55b0e0428443bda69f5ca Mon Sep 17 00:00:00 2001 From: shats Date: Tue, 3 Feb 2026 21:26:47 +0700 Subject: [PATCH] fix(mikrotikConfigRoutes, mikrotikApplyService): update default port for MikroTik API connections from 443 to 80 to align with REST API standards --- backend/routes/mikrotikConfigRoutes.js | 6 +++--- backend/services/mikrotikApplyService.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/routes/mikrotikConfigRoutes.js b/backend/routes/mikrotikConfigRoutes.js index c21d105..ece721e 100644 --- a/backend/routes/mikrotikConfigRoutes.js +++ b/backend/routes/mikrotikConfigRoutes.js @@ -57,8 +57,8 @@ function getMikrotikCredentials(server) { const host = server.mikrotikHost || server.ip || server.dns; if (!host) return null; const port = server.mikrotikPort; - // REST API: порт 80 (HTTP, www) или 443 (HTTPS, www-ssl). Если 8728 (старый API) — по умолчанию 443 - const restPort = (port === 80 || port === 443 || port === 8443) ? port : 443; + // REST API: порт 80 (HTTP, www) или 443 (HTTPS, www-ssl). По умолчанию 80 + const restPort = (port === 80 || port === 443 || port === 8443) ? port : 80; const user = server.mikrotikUser || 'admin'; let password = ''; if (server.encryptedMikrotikPassword) { @@ -171,7 +171,7 @@ async function testMikrotikConnection(req, res) { } else if (host && user !== undefined) { creds = { host, - port: port || 443, + port: port || 80, user, password: password || '', secure: false, diff --git a/backend/services/mikrotikApplyService.js b/backend/services/mikrotikApplyService.js index 011f5d4..d745bab 100644 --- a/backend/services/mikrotikApplyService.js +++ b/backend/services/mikrotikApplyService.js @@ -14,7 +14,7 @@ const https = require('https'); * @returns {object} client с методами print, add, set, remove, command */ function createRosClient(opts) { - const { host, port = 443, user, password, secure = false } = opts; + const { host, port = 80, user, password, secure = false } = opts; const useHttp = port === 80; const protocol = useHttp ? http : https;