Skip to content

Commit a1d485e

Browse files
committed
TUN-5823: Warn about legacy flags that are ignored when ingress rules are used
1 parent 8a1ba1f commit a1d485e

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

cmd/cloudflared/tunnel/cmd.go

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -724,43 +724,43 @@ func configureProxyFlags(shouldHide bool) []cli.Flag {
724724
}),
725725
altsrc.NewBoolFlag(&cli.BoolFlag{
726726
Name: ingress.Socks5Flag,
727-
Usage: "specify if this tunnel is running as a SOCK5 Server",
727+
Usage: legacyTunnelFlag("specify if this tunnel is running as a SOCK5 Server"),
728728
EnvVars: []string{"TUNNEL_SOCKS"},
729729
Value: false,
730730
Hidden: shouldHide,
731731
}),
732732
altsrc.NewDurationFlag(&cli.DurationFlag{
733733
Name: ingress.ProxyConnectTimeoutFlag,
734-
Usage: "HTTP proxy timeout for establishing a new connection",
734+
Usage: legacyTunnelFlag("HTTP proxy timeout for establishing a new connection"),
735735
Value: time.Second * 30,
736736
Hidden: shouldHide,
737737
}),
738738
altsrc.NewDurationFlag(&cli.DurationFlag{
739739
Name: ingress.ProxyTLSTimeoutFlag,
740-
Usage: "HTTP proxy timeout for completing a TLS handshake",
740+
Usage: legacyTunnelFlag("HTTP proxy timeout for completing a TLS handshake"),
741741
Value: time.Second * 10,
742742
Hidden: shouldHide,
743743
}),
744744
altsrc.NewDurationFlag(&cli.DurationFlag{
745745
Name: ingress.ProxyTCPKeepAliveFlag,
746-
Usage: "HTTP proxy TCP keepalive duration",
746+
Usage: legacyTunnelFlag("HTTP proxy TCP keepalive duration"),
747747
Value: time.Second * 30,
748748
Hidden: shouldHide,
749749
}),
750750
altsrc.NewBoolFlag(&cli.BoolFlag{
751751
Name: ingress.ProxyNoHappyEyeballsFlag,
752-
Usage: "HTTP proxy should disable \"happy eyeballs\" for IPv4/v6 fallback",
752+
Usage: legacyTunnelFlag("HTTP proxy should disable \"happy eyeballs\" for IPv4/v6 fallback"),
753753
Hidden: shouldHide,
754754
}),
755755
altsrc.NewIntFlag(&cli.IntFlag{
756756
Name: ingress.ProxyKeepAliveConnectionsFlag,
757-
Usage: "HTTP proxy maximum keepalive connection pool size",
757+
Usage: legacyTunnelFlag("HTTP proxy maximum keepalive connection pool size"),
758758
Value: 100,
759759
Hidden: shouldHide,
760760
}),
761761
altsrc.NewDurationFlag(&cli.DurationFlag{
762762
Name: ingress.ProxyKeepAliveTimeoutFlag,
763-
Usage: "HTTP proxy timeout for closing an idle connection",
763+
Usage: legacyTunnelFlag("HTTP proxy timeout for closing an idle connection"),
764764
Value: time.Second * 90,
765765
Hidden: shouldHide,
766766
}),
@@ -778,13 +778,13 @@ func configureProxyFlags(shouldHide bool) []cli.Flag {
778778
}),
779779
altsrc.NewStringFlag(&cli.StringFlag{
780780
Name: ingress.HTTPHostHeaderFlag,
781-
Usage: "Sets the HTTP Host header for the local webserver.",
781+
Usage: legacyTunnelFlag("Sets the HTTP Host header for the local webserver."),
782782
EnvVars: []string{"TUNNEL_HTTP_HOST_HEADER"},
783783
Hidden: shouldHide,
784784
}),
785785
altsrc.NewStringFlag(&cli.StringFlag{
786786
Name: ingress.OriginServerNameFlag,
787-
Usage: "Hostname on the origin server certificate.",
787+
Usage: legacyTunnelFlag("Hostname on the origin server certificate."),
788788
EnvVars: []string{"TUNNEL_ORIGIN_SERVER_NAME"},
789789
Hidden: shouldHide,
790790
}),
@@ -796,26 +796,35 @@ func configureProxyFlags(shouldHide bool) []cli.Flag {
796796
}),
797797
altsrc.NewStringFlag(&cli.StringFlag{
798798
Name: tlsconfig.OriginCAPoolFlag,
799-
Usage: "Path to the CA for the certificate of your origin. This option should be used only if your certificate is not signed by Cloudflare.",
799+
Usage: legacyTunnelFlag("Path to the CA for the certificate of your origin. This option should be used only if your certificate is not signed by Cloudflare."),
800800
EnvVars: []string{"TUNNEL_ORIGIN_CA_POOL"},
801801
Hidden: shouldHide,
802802
}),
803803
altsrc.NewBoolFlag(&cli.BoolFlag{
804804
Name: ingress.NoTLSVerifyFlag,
805-
Usage: "Disables TLS verification of the certificate presented by your origin. Will allow any certificate from the origin to be accepted. Note: The connection from your machine to Cloudflare's Edge is still encrypted.",
805+
Usage: legacyTunnelFlag("Disables TLS verification of the certificate presented by your origin. Will allow any certificate from the origin to be accepted. Note: The connection from your machine to Cloudflare's Edge is still encrypted."),
806806
EnvVars: []string{"NO_TLS_VERIFY"},
807807
Hidden: shouldHide,
808808
}),
809809
altsrc.NewBoolFlag(&cli.BoolFlag{
810810
Name: ingress.NoChunkedEncodingFlag,
811-
Usage: "Disables chunked transfer encoding; useful if you are running a WSGI server.",
811+
Usage: legacyTunnelFlag("Disables chunked transfer encoding; useful if you are running a WSGI server."),
812812
EnvVars: []string{"TUNNEL_NO_CHUNKED_ENCODING"},
813813
Hidden: shouldHide,
814814
}),
815815
}
816816
return append(flags, sshFlags(shouldHide)...)
817817
}
818818

819+
func legacyTunnelFlag(msg string) string {
820+
return fmt.Sprintf(
821+
"%s This flag only takes effect if you define your origin with `--url` and if you do not use ingress rules."+
822+
" The recommended way is to rely on ingress rules and define this property under `originRequest` as per"+
823+
" https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/configuration/configuration-file/ingress",
824+
msg,
825+
)
826+
}
827+
819828
func sshFlags(shouldHide bool) []cli.Flag {
820829
return []cli.Flag{
821830
altsrc.NewStringFlag(&cli.StringFlag{

0 commit comments

Comments
 (0)