Skip to content

feat: add session timeout cookie#22950

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

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

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

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