diff --git a/pkg/server/errorshandler/handler_sentry.go b/pkg/server/errorshandler/handler_sentry.go index 7e05676..f3b6a5a 100644 --- a/pkg/server/errorshandler/handler_sentry.go +++ b/pkg/server/errorshandler/handler_sentry.go @@ -20,17 +20,23 @@ func (handler *Handler) HandleSentry(ctx *fasthttp.RequestCtx) { return } - // check that X-Sentry-Auth header is available - auth := ctx.Request.Header.Peek("X-Sentry-Auth") + var auth []byte + // parse incoming get request params + auth = ctx.QueryArgs().Peek("sentry_key") if auth == nil { - log.Warnf("Incoming request without X-Sentry-Auth header") - sendAnswerHTTP(ctx, ResponseMessage{Code: 400, Error: true, Message: "X-Sentry-Auth header is missing"}) - return + log.Warnf("Incoming request with deprecated sentry_key parameter") + // check that X-Sentry-Auth header is available + auth = ctx.Request.Header.Peek("X-Sentry-Auth") + if auth == nil { + log.Warnf("Incoming request without X-Sentry-Auth header") + sendAnswerHTTP(ctx, ResponseMessage{Code: 400, Error: true, Message: "X-Sentry-Auth header is missing"}) + return + } } hawkToken, err := getSentryKeyFromAuth(string(auth)) if err != nil { - log.Warnf("Incoming request with invalid X-Sentry-Auth header: %s", err) + log.Warnf("Incoming request with invalid X-Sentry-Auth header=%s: %s", auth, err) sendAnswerHTTP(ctx, ResponseMessage{Code: 400, Error: true, Message: err.Error()}) return } diff --git a/pkg/server/server.go b/pkg/server/server.go index 7bca183..dbf20fe 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -137,12 +137,7 @@ func (s *Server) handler(ctx *fasthttp.RequestCtx) { case "/release": s.ReleaseHandler.HandleHTTP(ctx) case "/api/0/envelope/": - auth := ctx.Request.Header.Peek("X-Sentry-Auth") - if auth != nil { - s.ErrorsHandler.HandleSentry(ctx) - } else { - ctx.Error("X-Sentry-Auth not found", fasthttp.StatusBadRequest) - } + s.ErrorsHandler.HandleSentry(ctx) default: ctx.Error("Not found", fasthttp.StatusNotFound) }