Skip to content

feat: add session timeout cookie#22950

Closed
netroms wants to merge 11 commits intomasterfrom
DHIS2-20924
Closed

feat: add session timeout cookie#22950
netroms wants to merge 11 commits intomasterfrom
DHIS2-20924

Conversation

@netroms
Copy link
Contributor

@netroms netroms commented Feb 12, 2026

NOTE: the cookie part of this is duplicated by #23115

Summary

  • Fix auth entry points to return 401 JSON for all /api/ requests instead of 302 redirect to login page. The old detection only checked X-Requested-With: XMLHttpRequest (a jQuery convention that modern fetch() doesn't send), so SPA clients got broken redirects on session expiry.
  • Add SESSION_EXPIRE cookie so front-end SPAs can detect session expiry via document.cookie without intercepting response headers.
  • Fix expired session strategy to return 401 JSON for API requests instead of redirecting to logout action.

@netroms netroms added the deploy Deploy DHIS2 instance with IM. label Feb 12, 2026
@netroms netroms changed the title fix: return 401 JSON for API requests instead of 302 redirect, add X-Session-Timeout header [DHIS2-20924] feat: add session timeout cookie Feb 12, 2026
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
@netroms netroms marked this pull request as draft February 13, 2026 06:48
@sonarqubecloud
Copy link

@github-actions
Copy link

Instance deployed to https://dev.im.dhis2.org/pr-22950

@KaiVandivier KaiVandivier requested review from a team March 2, 2026 13:45
@netroms netroms closed this Mar 4, 2026
@netroms netroms deleted the DHIS2-20924 branch March 4, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy Deploy DHIS2 instance with IM.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants