Skip to content

Commit 103d48e

Browse files
committed
Merge branch 'feat/9-reverse-proxy-config-override'
Reverse-proxy/tunnel options (alias_port etc.) and config_override, extracted from PR #9 without the OIDC feature (kept separate as #8). Closes #9.
2 parents fd05ca3 + ffca230 commit 103d48e

5 files changed

Lines changed: 129 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## \[0.2.14\] - 2026-07-26
4+
5+
### Added
6+
7+
- **Reverse proxy / tunnel options** — makes MeshCentral fully usable behind Cloudflare Tunnel, NGINX Proxy Manager, Traefik, etc. (thanks @ddcash):
8+
- `alias_port` — the publicly visible HTTPS port (e.g. `443` behind Cloudflare Tunnel). Without it, agent installers point at port 4430 and agents behind a proxy can never connect.
9+
- `agent_alias_port` / `agent_alias_dns` — same aliasing for the dedicated agent port
10+
- `agent_pong` / `browser_pong` — WebSocket keepalive intervals; needed behind proxies that drop idle connections (Cloudflare: ~100 s)
11+
- `minify` — serve reduced-size web pages
12+
- `config_override` — advanced: raw JSON object deep-merged on top of the generated config.json as the last step, making every MeshCentral setting reachable even without a dedicated add-on option
13+
314
## \[0.2.13\] - 2026-07-10
415

516
### Added

meshcentral/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## \[0.2.14\] - 2026-07-26
4+
5+
### Added
6+
7+
- **Reverse proxy / tunnel options** — makes MeshCentral fully usable behind Cloudflare Tunnel, NGINX Proxy Manager, Traefik, etc. (thanks @ddcash):
8+
- `alias_port` — the publicly visible HTTPS port (e.g. `443` behind Cloudflare Tunnel). Without it, agent installers point at port 4430 and agents behind a proxy can never connect.
9+
- `agent_alias_port` / `agent_alias_dns` — same aliasing for the dedicated agent port
10+
- `agent_pong` / `browser_pong` — WebSocket keepalive intervals; needed behind proxies that drop idle connections (Cloudflare: ~100 s)
11+
- `minify` — serve reduced-size web pages
12+
- `config_override` — advanced: raw JSON object deep-merged on top of the generated config.json as the last step, making every MeshCentral setting reachable even without a dedicated add-on option
13+
314
## \[0.2.13\] - 2026-07-10
415

516
### Added

meshcentral/config.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MeshCentral",
3-
"version": "0.2.13",
3+
"version": "0.2.14",
44
"slug": "meshcentral",
55
"description": "Self-hosted remote device management — monitor and control your PCs from Home Assistant",
66
"url": "https://github.com/andlo/ha-meshcentral-addon",
@@ -48,6 +48,12 @@
4848
"agent_allowed_ip": "",
4949
"agent_blocked_ip": "",
5050
"agent_port": 0,
51+
"alias_port": 0,
52+
"agent_alias_port": 0,
53+
"agent_alias_dns": "",
54+
"agent_pong": 0,
55+
"browser_pong": 0,
56+
"minify": false,
5157
"mps_port": 4433,
5258
"backup_interval_hours": 24,
5359
"backup_keep_days": 10,
@@ -58,7 +64,8 @@
5864
"smtp_from": "",
5965
"smtp_user": "",
6066
"smtp_pass": "",
61-
"smtp_tls": true
67+
"smtp_tls": true,
68+
"config_override": ""
6269
},
6370
"schema": {
6471
"server_mode": "list(lan|wan|hybrid)",
@@ -90,6 +97,12 @@
9097
"agent_allowed_ip": "str?",
9198
"agent_blocked_ip": "str?",
9299
"agent_port": "int",
100+
"alias_port": "int",
101+
"agent_alias_port": "int",
102+
"agent_alias_dns": "str?",
103+
"agent_pong": "int",
104+
"browser_pong": "int",
105+
"minify": "bool",
93106
"mps_port": "int",
94107
"backup_interval_hours": "int",
95108
"backup_keep_days": "int",
@@ -100,7 +113,8 @@
100113
"smtp_from": "str?",
101114
"smtp_user": "str?",
102115
"smtp_pass": "password?",
103-
"smtp_tls": "bool?"
116+
"smtp_tls": "bool?",
117+
"config_override": "str?"
104118
},
105119
"map": [
106120
"data:rw",

meshcentral/run.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ MPS_PORT=$(bashio::config 'mps_port')
2525
BACKUP_INTERVAL=$(bashio::config 'backup_interval_hours')
2626
BACKUP_KEEP=$(bashio::config 'backup_keep_days')
2727
SMTP_ENABLED=$(bashio::config 'smtp_enabled')
28+
ALIAS_PORT=$(bashio::config 'alias_port')
29+
AGENT_ALIAS_PORT=$(bashio::config 'agent_alias_port')
30+
AGENT_PONG=$(bashio::config 'agent_pong')
31+
BROWSER_PONG=$(bashio::config 'browser_pong')
32+
MINIFY=$(bashio::config 'minify')
2833

2934
# ── Paths ─────────────────────────────────────────────────────────────────────
3035
# Everything lives in the add-on config folder (/addon_configs/<slug>, mounted
@@ -84,6 +89,28 @@ if [ "$AGENT_PORT" -gt 0 ] 2>/dev/null; then
8489
SETTINGS=$(echo "$SETTINGS" | jq --argjson v "$AGENT_PORT" '. + {agentPort: $v}')
8590
fi
8691

92+
# Alias ports — the publicly visible ports when behind a reverse proxy or tunnel
93+
# that listens on a different port than MeshCentral itself (e.g. Cloudflare on 443).
94+
# These control the port written into agent installers and links.
95+
if [ "$ALIAS_PORT" -gt 0 ] 2>/dev/null; then
96+
SETTINGS=$(echo "$SETTINGS" | jq --argjson v "$ALIAS_PORT" '. + {aliasPort: $v}')
97+
fi
98+
if [ "$AGENT_ALIAS_PORT" -gt 0 ] 2>/dev/null; then
99+
SETTINGS=$(echo "$SETTINGS" | jq --argjson v "$AGENT_ALIAS_PORT" '. + {agentAliasPort: $v}')
100+
fi
101+
if bashio::config.has_value 'agent_alias_dns'; then
102+
SETTINGS=$(echo "$SETTINGS" | jq --arg v "$(bashio::config 'agent_alias_dns')" '. + {agentAliasDNS: $v}')
103+
fi
104+
105+
# Keepalive intervals — needed behind proxies that drop idle WebSockets
106+
# (e.g. Cloudflare closes idle connections after ~100 seconds).
107+
if [ "$AGENT_PONG" -gt 0 ] 2>/dev/null; then
108+
SETTINGS=$(echo "$SETTINGS" | jq --argjson v "$AGENT_PONG" '. + {agentPong: $v}')
109+
fi
110+
if [ "$BROWSER_PONG" -gt 0 ] 2>/dev/null; then
111+
SETTINGS=$(echo "$SETTINGS" | jq --argjson v "$BROWSER_PONG" '. + {browserPong: $v}')
112+
fi
113+
87114
# Cert / hostname
88115
if bashio::config.has_value 'cert_url'; then
89116
CERT_HOST=$(bashio::config 'cert_url' | sed 's|https://||' | sed 's|http://||' | sed 's|/.*||')
@@ -192,6 +219,10 @@ if bashio::config.has_value 'cert_url'; then
192219
DOMAIN=$(echo "$DOMAIN" | jq --arg v "$(bashio::config 'cert_url')" '. + {certUrl: $v}')
193220
fi
194221

222+
if [ "$MINIFY" = "true" ]; then
223+
DOMAIN=$(echo "$DOMAIN" | jq '. + {minify: true}')
224+
fi
225+
195226
DOMAIN=$(echo "$DOMAIN" | jq --arg rp "$RECORDINGS_PATH" \
196227
'. + {sessionRecording: {filepath: $rp}}')
197228

@@ -228,6 +259,19 @@ else
228259
'{settings: $settings, domains: {"": $domain}, smtp: $smtp}')
229260
fi
230261

262+
# ── Apply raw JSON overrides (advanced) ───────────────────────────────────────
263+
# config_override is deep-merged on top of the generated config as the last step,
264+
# so any MeshCentral setting can be reached even if the add-on has no option for it.
265+
if bashio::config.has_value 'config_override'; then
266+
OVERRIDE=$(bashio::config 'config_override')
267+
if echo "$OVERRIDE" | jq -e 'type == "object"' >/dev/null 2>&1; then
268+
CONFIG=$(jq -n --argjson base "$CONFIG" --argjson ovr "$OVERRIDE" '$base * $ovr')
269+
bashio::log.info "config_override applied on top of the generated config."
270+
else
271+
bashio::log.warning "config_override is not a valid JSON object — ignored."
272+
fi
273+
fi
274+
231275
echo "$CONFIG" > "$CONFIG_FILE"
232276
bashio::log.info "config.json written."
233277

meshcentral/translations/en.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,44 @@ configuration:
176176
Optional separate HTTPS port exclusively for agent connections.
177177
Set to 0 (default) to use the main port (4430) for everything.
178178
179+
alias_port:
180+
name: Public alias port
181+
description: >-
182+
The publicly visible HTTPS port when MeshCentral runs behind a reverse proxy or tunnel
183+
that listens on a different port (e.g. set to 443 behind Cloudflare Tunnel or NGINX on 443).
184+
Controls the port written into agent installers and links. Set to 0 (default) to disable.
185+
186+
agent_alias_port:
187+
name: Agent alias port
188+
description: >-
189+
The publicly visible port for the dedicated agent port, when a reverse proxy in front of it
190+
listens on a different port. Only relevant when a dedicated agent port is set.
191+
Set to 0 (default) to disable.
192+
193+
agent_alias_dns:
194+
name: Agent alias DNS name
195+
description: >-
196+
Optional DNS name agents use to connect to the dedicated agent port, if different
197+
from the main hostname. Leave empty to use the main hostname.
198+
199+
agent_pong:
200+
name: Agent keepalive interval (seconds)
201+
description: >-
202+
Send keepalive data to connected agents every this many seconds. Needed behind proxies
203+
that drop idle WebSocket connections — e.g. set to 60 behind Cloudflare, which closes
204+
idle connections after about 100 seconds. Set to 0 (default) to disable.
205+
206+
browser_pong:
207+
name: Browser keepalive interval (seconds)
208+
description: >-
209+
Send keepalive data to connected browsers every this many seconds. Same purpose as the
210+
agent keepalive, but for web sessions. Set to 0 (default) to disable.
211+
212+
minify:
213+
name: Minify web pages
214+
description: >-
215+
Serve reduced-size web pages to save bandwidth. Disabled by default.
216+
179217
mps_port:
180218
name: Intel AMT / MPS port
181219
description: >-
@@ -235,3 +273,11 @@ configuration:
235273
description: >-
236274
Enable TLS/STARTTLS for the SMTP connection. Should be enabled for port 587.
237275
Disable only if your SMTP server does not support TLS.
276+
277+
config_override:
278+
name: Config override (advanced, raw JSON)
279+
description: >-
280+
Advanced — a JSON object deep-merged on top of the generated config.json as the last step.
281+
Lets you set any MeshCentral option the add-on does not expose
282+
(e.g. {"settings":{"sessionRecording":true}}). Invalid JSON is ignored with a warning.
283+
See the MeshCentral config schema for all available settings.

0 commit comments

Comments
 (0)