diff --git a/cmd/server/main.go b/cmd/server/main.go index 53fef6dbb..10738227e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "net/http" "net/url" "time" @@ -44,6 +45,9 @@ func main() { TracesSampleRate: config.G.ErrorReporting.SampleRate, Release: fmt.Sprintf("authentik@%s", constants.VERSION), Environment: config.G.ErrorReporting.Environment, + IgnoreErrors: []string{ + http.ErrAbortHandler.Error(), + }, }) if err != nil { l.WithError(err).Warning("failed to init sentry") diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 7911a8298..8f927f9ac 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -42,6 +42,9 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { Dsn: dsn, Environment: globalConfig.ErrorReporting.Environment, TracesSampleRate: float64(globalConfig.ErrorReporting.TracesSampleRate), + IgnoreErrors: []string{ + http.ErrAbortHandler.Error(), + }, }) if err != nil { log.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry") diff --git a/internal/outpost/proxyv2/application/mode_proxy.go b/internal/outpost/proxyv2/application/mode_proxy.go index 3a3b56f56..4630c2503 100644 --- a/internal/outpost/proxyv2/application/mode_proxy.go +++ b/internal/outpost/proxyv2/application/mode_proxy.go @@ -10,6 +10,7 @@ import ( "github.com/getsentry/sentry-go" "github.com/prometheus/client_golang/prometheus" + log "github.com/sirupsen/logrus" "goauthentik.io/internal/outpost/ak" "goauthentik.io/internal/outpost/proxyv2/metrics" "goauthentik.io/internal/outpost/proxyv2/templates" @@ -45,6 +46,13 @@ func (a *Application) configureProxy() error { } before := time.Now() rp.ServeHTTP(rw, r) + defer func() { + err := recover() + if err == nil || err == http.ErrAbortHandler { + return + } + log.WithError(err.(error)).Error("recover in reverse proxy") + }() after := time.Since(before) user := ""