@@ -216,6 +216,7 @@ func prepareTunnelConfig(
216216 )
217217
218218 transportProtocol := c .String ("protocol" )
219+ protocolFetcher := edgediscovery .ProtocolPercentage
219220
220221 cfg := config .GetConfiguration ()
221222 if isNamedTunnel {
@@ -227,7 +228,20 @@ func prepareTunnelConfig(
227228 features := append (c .StringSlice ("features" ), supervisor .FeatureSerializedHeaders )
228229 if c .IsSet (TunnelTokenFlag ) {
229230 if transportProtocol == connection .AutoSelectFlag {
230- transportProtocol = connection .QUIC .String ()
231+ protocolFetcher = func () (edgediscovery.ProtocolPercents , error ) {
232+ // If the Tunnel is remotely managed and no protocol is set, we prefer QUIC, but still allow fall-back.
233+ preferQuic := []edgediscovery.ProtocolPercent {
234+ {
235+ Protocol : connection .QUIC .String (),
236+ Percentage : 100 ,
237+ },
238+ {
239+ Protocol : connection .HTTP2 .String (),
240+ Percentage : 100 ,
241+ },
242+ }
243+ return preferQuic , nil
244+ }
231245 }
232246 features = append (features , supervisor .FeatureAllowRemoteConfig )
233247 log .Info ().Msg ("Will be fetching remotely managed configuration from Cloudflare API. Defaulting to protocol: quic" )
@@ -274,7 +288,7 @@ func prepareTunnelConfig(
274288 }
275289
276290 warpRoutingEnabled := isWarpRoutingEnabled (cfg .WarpRouting , isNamedTunnel )
277- protocolSelector , err := connection .NewProtocolSelector (transportProtocol , warpRoutingEnabled , namedTunnel , edgediscovery . ProtocolPercentage , supervisor .ResolveTTL , log )
291+ protocolSelector , err := connection .NewProtocolSelector (transportProtocol , warpRoutingEnabled , namedTunnel , protocolFetcher , supervisor .ResolveTTL , log )
278292 if err != nil {
279293 return nil , nil , err
280294 }
0 commit comments