integration: add tests for api bypass (#2811)

This commit is contained in:
Kristoffer Dalby
2025-10-22 16:30:25 +02:00
committed by GitHub
parent 1cdea7ed9b
commit 66826232ff
3 changed files with 664 additions and 3 deletions

View File

@@ -405,12 +405,12 @@ func (h *Headscale) httpAuthenticationMiddleware(next http.Handler) http.Handler
valid, err := h.state.ValidateAPIKey(strings.TrimPrefix(authHeader, AuthPrefix))
if err != nil {
log.Error().
log.Info().
Caller().
Err(err).
Str("client_address", req.RemoteAddr).
Msg("failed to validate token")
writeUnauthorized(http.StatusInternalServerError)
writeUnauthorized(http.StatusUnauthorized)
return
}