-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update embeded derp host to requested host #1424
Update embeded derp host to requested host #1424
Conversation
First of all, thank you so much for the PR! I see a problem, though. One biggest sources of issues for headscale users are misconfigured reverse proxies. If we start depending on the user configuring also the Host header, that'd be a problem... |
The concern is that someone would configure a reverse proxy to override the Host header incorrectly? I'm reading through the golang |
@juanfont it looks like request.URL actually won't work. From go docs:
Given that there may be some risk for reverse proxies, would you accept the original feature (using Host) as a configuration option (default off)? |
But Host will depend on how you configure your reverse proxy. For instance, in a typical nginx configuration users usually have something like This will cause that the default Host header that Headscale will see will be something like '127.0.0.1:8000' or 'foobar:8000' - because that's the host nginx is calling to. Only if the user remembers to overwrite the Host header to whatever real FQDN would your proposed solution work :( |
I'm a bit confused about this because my setup seems fairly "normal" and my patch is working for this use case without either nginx or headscale ever needing to know the FQDN. I wonder if golang's http library is doing something unexpected to fill out
If I then set an
Regardless, as an optional configuration parameter, we can provide documentation on how to configure your reverse proxy to use this config. |
Ah, after adding some more debug lines it looks like this works because of the noise protocol. Even though the reverse proxy may have the wrong host, inside the noise hijack HTTP connection, the Host is whatever was set by the tailscale client. So this should actually work regardless of reverse proxy settings, assuming the client is using noise :) Does this change your view on the risk of this change, either as a default config or optional? Edit: we can have this feature only apply to noise connections to further reducer risk |
But this adds complexity. And we still need And to be fair, having both |
Yes, this options adds some code complexity and that should always be weighed as a tradeoff against what is accomplishes. I believe the complexity is worthwhile as it will simplify requirements for reverse proxy users, by no longer requiring the FQDN to be known at startup in This is a judgment call for the maintainers and community. Perhaps we can wait to see if other users on discord/github chime in with a desire for this feature. I'm happy to iterate on the implementation details and documentation in the future. |
Hi! as part of #1473, we have reorganised a lot of the code. To clear PRs that needs to be rebased or redone, we are closing open PRs that will require significant code change to be merged. In addition, the issue of the PR might in some cases have been fixed, change or no longer relevant, so it would be great if this is considered as well. Thank you for your contribution! If it is still relevant and the PR is reopened, we will aim at getting the changes into the next release after the reorg if accepted. |
DRAFT implementation of #1423. Not super happy with the implementation, but this may help illustrate the desired feature.