mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 07:57:34 +00:00
Also warn in DERP server if Websockets are not properly working
This commit is contained in:
parent
a377ee14b4
commit
5c59255b41
@ -99,10 +99,13 @@ func (h *Headscale) DERPHandler(
|
|||||||
req *http.Request,
|
req *http.Request,
|
||||||
) {
|
) {
|
||||||
log.Trace().Caller().Msgf("/derp request from %v", req.RemoteAddr)
|
log.Trace().Caller().Msgf("/derp request from %v", req.RemoteAddr)
|
||||||
up := strings.ToLower(req.Header.Get("Upgrade"))
|
upgrade := strings.ToLower(req.Header.Get("Upgrade"))
|
||||||
if up != "websocket" && up != "derp" {
|
|
||||||
if up != "" {
|
if upgrade != "websocket" && upgrade != "derp" {
|
||||||
log.Warn().Caller().Msgf("Weird websockets connection upgrade: %q", up)
|
if upgrade != "" {
|
||||||
|
log.Warn().
|
||||||
|
Caller().
|
||||||
|
Msg("No Upgrade header in DERP server request. If headscale is behind a reverse proxy, make sure it is configured to pass WebSockets through.")
|
||||||
}
|
}
|
||||||
writer.Header().Set("Content-Type", "text/plain")
|
writer.Header().Set("Content-Type", "text/plain")
|
||||||
writer.WriteHeader(http.StatusUpgradeRequired)
|
writer.WriteHeader(http.StatusUpgradeRequired)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user