Skip to content

fix: include custom agent headers in tailnet to support DERP connections #15145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Oct 21, 2024

Fixes #15131.

I introduced a CODER_AGENT_HEADER option for supplying extra headers for the agent, but these headers weren't included when communicating with DERP relays. This PR plumbs them into tailnet.NewConn as required.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ethanndickson and the rest of your teammates on Graphite Graphite

@ethanndickson ethanndickson marked this pull request as ready for review October 21, 2024 01:38
@ethanndickson
Copy link
Member Author

ethanndickson commented Oct 21, 2024

image
Interesting new grammar bot prompt.. Not sure if I'm a fan.

@ethanndickson ethanndickson changed the title fix: include custom agent headers in tailnet fix: include custom agent headers in tailnet to fix #15131 Oct 21, 2024
@ethanndickson ethanndickson changed the title fix: include custom agent headers in tailnet to fix #15131 fix: include custom agent headers in tailnet to support DERP connections Oct 21, 2024
@ethanndickson ethanndickson force-pushed the ethan/agent-derp-headers branch from b09f08f to eb5a0d9 Compare October 21, 2024 04:19

// We set the handler after server creation for the access URL.
coderAPI := coderd.New(newOptions)
setHandler(coderAPI.RootHandler)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of setting this handler --- isn't that already the handler the API will use?

Copy link
Member Author

@ethanndickson ethanndickson Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this case, calling NewWithAPI normally sets the handler to coderAPI.RootHandler.

	setHandler, cancelFunc, serverURL, newOptions := NewOptions(t, options)
	// We set the handler after server creation for the access URL.
	coderAPI := coderd.New(newOptions)
	setHandler(coderAPI.RootHandler)

@ethanndickson ethanndickson merged commit c5a4095 into main Oct 21, 2024
27 checks passed
@ethanndickson ethanndickson deleted the ethan/agent-derp-headers branch October 21, 2024 09:59
@github-actions github-actions bot locked and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CODER_AGENT_HEADER still not sufficiently implemented for DERP, netcheck
2 participants