Skip to content

Commit b4d5f59

Browse files
committed
fix: add --block-direct-connections to wsproxies
1 parent 52a7f86 commit b4d5f59

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

codersdk/deployment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,8 @@ when required by your organization's security policy.`,
880880
Env: "CODER_BLOCK_DIRECT",
881881
Value: &c.DERP.Config.BlockDirect,
882882
Group: &deploymentGroupNetworkingDERP,
883-
YAML: "blockDirect",
883+
YAML: "blockDirect", Annotations: clibase.Annotations{}.
884+
Mark(annotationExternalProxies, "true"),
884885
},
885886
{
886887
Name: "DERP Force WebSockets",

enterprise/cli/proxyserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ func (r *RootCmd) proxyServer() *clibase.Cmd {
262262
AllowAllCors: cfg.Dangerous.AllowAllCors.Value(),
263263
DERPEnabled: cfg.DERP.Server.Enable.Value(),
264264
DERPOnly: derpOnly.Value(),
265+
BlockDirect: cfg.DERP.Config.BlockDirect.Value(),
265266
DERPServerRelayAddress: cfg.DERP.Server.RelayURL.String(),
266267
})
267268
if err != nil {

enterprise/cli/proxyserver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/coder/coder/v2/pty/ptytest"
1414
)
1515

16-
func Test_Headers(t *testing.T) {
16+
func Test_ProxyServer_Headers(t *testing.T) {
1717
t.Parallel()
1818

1919
const (

enterprise/wsproxy/wsproxy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ type Options struct {
7575
// DERPOnly determines whether this proxy only provides DERP and does not
7676
// provide access to workspace apps/terminal.
7777
DERPOnly bool
78+
// BlockDirect controls the servertailnet of the proxy, forcing it from
79+
// negotiating direct connections.
80+
BlockDirect bool
7881

7982
ProxySessionToken string
8083
// AllowAllCors will set all CORs headers to '*'.
@@ -250,7 +253,7 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
250253
},
251254
regResp.DERPForceWebSockets,
252255
s.DialCoordinator,
253-
false, // TODO: this will be covered in a subsequent pr.
256+
opts.BlockDirect,
254257
s.TracerProvider,
255258
)
256259
if err != nil {

0 commit comments

Comments
 (0)