outposts: handle/ignore http Abort handler
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
82acba26af
commit
68637cf7cf
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@ func main() {
|
||||||
TracesSampleRate: config.G.ErrorReporting.SampleRate,
|
TracesSampleRate: config.G.ErrorReporting.SampleRate,
|
||||||
Release: fmt.Sprintf("authentik@%s", constants.VERSION),
|
Release: fmt.Sprintf("authentik@%s", constants.VERSION),
|
||||||
Environment: config.G.ErrorReporting.Environment,
|
Environment: config.G.ErrorReporting.Environment,
|
||||||
|
IgnoreErrors: []string{
|
||||||
|
http.ErrAbortHandler.Error(),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.WithError(err).Warning("failed to init sentry")
|
l.WithError(err).Warning("failed to init sentry")
|
||||||
|
|
|
@ -42,6 +42,9 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) {
|
||||||
Dsn: dsn,
|
Dsn: dsn,
|
||||||
Environment: globalConfig.ErrorReporting.Environment,
|
Environment: globalConfig.ErrorReporting.Environment,
|
||||||
TracesSampleRate: float64(globalConfig.ErrorReporting.TracesSampleRate),
|
TracesSampleRate: float64(globalConfig.ErrorReporting.TracesSampleRate),
|
||||||
|
IgnoreErrors: []string{
|
||||||
|
http.ErrAbortHandler.Error(),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry")
|
log.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry")
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"goauthentik.io/internal/outpost/ak"
|
"goauthentik.io/internal/outpost/ak"
|
||||||
"goauthentik.io/internal/outpost/proxyv2/metrics"
|
"goauthentik.io/internal/outpost/proxyv2/metrics"
|
||||||
"goauthentik.io/internal/outpost/proxyv2/templates"
|
"goauthentik.io/internal/outpost/proxyv2/templates"
|
||||||
|
@ -45,6 +46,13 @@ func (a *Application) configureProxy() error {
|
||||||
}
|
}
|
||||||
before := time.Now()
|
before := time.Now()
|
||||||
rp.ServeHTTP(rw, r)
|
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)
|
after := time.Since(before)
|
||||||
|
|
||||||
user := ""
|
user := ""
|
||||||
|
|
Reference in New Issue