From 2a6fccd22a02a854b8527d156af9dc66309db704 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 16 Jun 2022 10:32:32 +0200 Subject: [PATCH] providers/proxy: only send misconfiguration event once Signed-off-by: Jens Langhammer --- internal/outpost/proxyv2/application/mode_common.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/outpost/proxyv2/application/mode_common.go b/internal/outpost/proxyv2/application/mode_common.go index 9f24a192e..c5a95c524 100644 --- a/internal/outpost/proxyv2/application/mode_common.go +++ b/internal/outpost/proxyv2/application/mode_common.go @@ -13,6 +13,8 @@ import ( "goauthentik.io/internal/constants" ) +var hasReportedMisconfiguration = false + func (a *Application) addHeaders(headers http.Header, c *Claims) { // https://goauthentik.io/docs/providers/proxy/proxy @@ -103,6 +105,9 @@ func (a *Application) getNginxForwardUrl(r *http.Request) (*url.URL, error) { func (a *Application) ReportMisconfiguration(r *http.Request, msg string, fields map[string]interface{}) { fields["message"] = msg a.log.WithFields(fields).Error("Reporting configuration error") + if hasReportedMisconfiguration { + return + } req := api.EventRequest{ Action: api.EVENTACTIONS_CONFIGURATION_ERROR, App: "authentik.providers.proxy", // must match python apps.py name @@ -112,6 +117,8 @@ func (a *Application) ReportMisconfiguration(r *http.Request, msg string, fields _, _, err := a.ak.Client.EventsApi.EventsEventsCreate(context.Background()).EventRequest(req).Execute() if err != nil { a.log.WithError(err).Warning("failed to report configuration error") + } else { + hasReportedMisconfiguration = true } }