|
|
@@ -56,6 +56,35 @@ container address. The three pieces must stay in sync:
|
|
56
|
56
|
If you disable one, disable all three, otherwise the backend will fail
|
|
57
|
57
|
to parse the connection.
|
|
58
|
58
|
|
|
|
59
|
+## Fronting loop (why `[domain-fronting]` is set explicitly)
|
|
|
60
|
+
|
|
|
61
|
+When mtg sees TLS traffic that isn't valid Telegram (a probe or a
|
|
|
62
|
+browser hitting your domain on `:443`), it forwards that connection to
|
|
|
63
|
+a real web server — "domain fronting". By default mtg uses the
|
|
|
64
|
+secret's hostname as the fronting target and resolves it via DNS.
|
|
|
65
|
+
|
|
|
66
|
+In this setup that hostname resolves back to **this** server, so mtg's
|
|
|
67
|
+fronting dial would hit HAProxy on `:443`, HAProxy would see the SNI
|
|
|
68
|
+matching the secret and route the connection back to mtg → loop.
|
|
|
69
|
+
|
|
|
70
|
+To break the loop, `mtg-config.toml` pins the fronting target to
|
|
|
71
|
+Caddy's container address directly:
|
|
|
72
|
+
|
|
|
73
|
+```toml
|
|
|
74
|
+[domain-fronting]
|
|
|
75
|
+ip = "172.28.0.10"
|
|
|
76
|
+port = 8443
|
|
|
77
|
+proxy-protocol = true
|
|
|
78
|
+```
|
|
|
79
|
+
|
|
|
80
|
+The IP matches `services.web.networks.sni.ipv4_address` in
|
|
|
81
|
+`docker-compose.yml` (mtg's `domain-fronting.ip` only accepts a literal
|
|
|
82
|
+IP, not a hostname, hence the static `sni` network). `proxy-protocol =
|
|
|
83
|
+true` matches Caddy's `:8443` listener wrapper so the real client IP
|
|
|
84
|
+still propagates to Caddy's logs.
|
|
|
85
|
+
|
|
|
86
|
+If you change Caddy's pinned IP, update both files together.
|
|
|
87
|
+
|
|
59
|
88
|
## ACME (Let's Encrypt) notes
|
|
60
|
89
|
|
|
61
|
90
|
HAProxy passes `/.well-known/acme-challenge/` requests on `:80` to
|