Skip to content

Fix/IcingaDBWeb: clean stale Icingaweb2 cookie only when Keycloak session is expired#1165

Merged
HenriWahl merged 3 commits into
HenriWahl:merge_icinga_cookie_fixfrom
Plattenspatz:fix/icingadbweb-cookie-session
Jan 20, 2026
Merged

Fix/IcingaDBWeb: clean stale Icingaweb2 cookie only when Keycloak session is expired#1165
HenriWahl merged 3 commits into
HenriWahl:merge_icinga_cookie_fixfrom
Plattenspatz:fix/icingadbweb-cookie-session

Conversation

@Plattenspatz
Copy link
Copy Markdown
Contributor

Fixes #1163

In an IcingaDBWeb + Keycloak setup, Nagstamon can get stuck in a redirect-to-login loop when a persisted Icingaweb2 session cookie from an older run is reused after the Keycloak session already expired server-side.

This PR adds a minimal, server-type-specific cleanup for IcingaDBWeb:

  • run cleanup only once per application start / server instance
  • only if Keycloak cookies are present
  • only if there is no valid KEYCLOAK_SESSION cookie (based on the local expiration timestamp)
  • then remove the persisted Icingaweb2 cookie from cookies.db

Additionally, it guards _set_recheck() against missing HTML form elements to avoid a crash when authentication expired and the expected form cannot be found.

@HenriWahl HenriWahl changed the base branch from master to merge_icinga_cookie_fix January 20, 2026 23:06
@HenriWahl
Copy link
Copy Markdown
Owner

Thanks @Plattenspatz!

@HenriWahl HenriWahl merged commit a5103ff into HenriWahl:merge_icinga_cookie_fix Jan 20, 2026
1 check passed
HenriWahl added a commit that referenced this pull request Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web login fails if old cookies.db exists

3 participants