File tree Expand file tree Collapse file tree
src/Common/Container/Providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33/**
44 * Relay tunnel configuration.
55 *
6- * For servers co-located with the hub, use 127.0.0.1 to avoid hairpin NAT issues.
7- * For remote servers, use the hub's public hostname with wss:// protocol.
6+ * The hub_relay_ws_url is normally derived from the enrollment's hub_base_url
7+ * at start time via RelayConfig::withAutoEnable(). Set it here only for
8+ * unusual deployment scenarios that cannot be handled by enrollment.
89 *
910 * @package Phlix\Config
1011 * @since 0.12.0
1920
2021 // Hub server-tunnel WS endpoint (Phlix\Hub\Relay\RelayWorker, default :8802).
2122 // The enrollment JWT is sent in the JSON HELLO body, not as an auth header.
22- // Use ws://127.0.0.1:8802 if hub and server are co-located (avoids hairpin NAT).
23- // Use wss://hub.phlix.interserver.net:8802 for remote servers .
24- 'hub_relay_ws_url ' => 'ws://127.0.0.1:8802 ' ,
23+ // When empty, the URL is derived from the enrollment's hub_base_url via
24+ // RelayConfig::withAutoEnable() at RelayConsumer start time .
25+ 'hub_relay_ws_url ' => '' ,
2526
2627 // This server's own local HTTP listener that relayed client bytes are piped to.
2728 'local_http_address ' => '127.0.0.1:8096 ' ,
Original file line number Diff line number Diff line change @@ -194,6 +194,10 @@ static function (ContainerInterface $c): RelayConsumer {
194194 $ enrollment = $ hubClient ->loadEnrollment ();
195195 $ serverId = $ enrollment !== null ? $ enrollment ->serverId : '' ;
196196
197+ if ($ enrollment !== null && $ enrollment ->hubBaseUrl !== '' ) {
198+ $ config = $ config ->withAutoEnable ($ enrollment ->hubBaseUrl );
199+ }
200+
197201 return new RelayConsumer (
198202 $ config ,
199203 $ hubClient ,
You can’t perform that action at this time.
0 commit comments