mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #3315] [bug]: In-memory sessions cause logins to fail in load-balanced clusters (401 Unauthorised) #1100
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dsole on GitHub (Sep 5, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3315
Is there an existing issue for this?
Current behavior
I am using the Microsoft authentication method but in theory this could be affecting the others.
The backend service is using express-session to hold some session state during the authentication flow. I believe this is required by the PassportJS library that is used to perform the OAuth authorisation flow.
However the express-session is not configured with a session storage provider via the
storeparameter and so defaults to in-memory sessions. As per their documentationIf the user lands on a different node in the cluster to process the OAuth code flow code callback, the session cannot be resolved and the Hoppscotch backend returns the error
Steps to reproduce
You can verify this by running the system in a multi-node, load balanced cluster such as Kubernetes with multiple replicas of the pod.
However a reliable way to replicate it locally is to stop and then restart the Hoppscotch backend server during the authentication phase, before the browser returns from the identity provider back to Hoppscotch to complete the login.
Environment
Production
Version
Self-hosted
@dsole commented on GitHub (Sep 5, 2023):
A possible solution would be to use a Postgres-backed session store using the database that is already available.
However I suggest the session store could be configurable so that alternate stores could be used such as a HA distributed store such as etcd or Redis
@nannan-motorq commented on GitHub (Nov 13, 2024):
Hi! Is there any update on this since I am facing the same issue.
@CorentinRegnier commented on GitHub (Feb 21, 2025):
Same issue here, when i set 2 replicas or more, backend callback return 401.
@spagno commented on GitHub (Jan 19, 2026):
Some issue here with google oauth. As workaround I configured the ingress with a cookie sticky session (self-hosted on kubernetes). The real fix could be to make redis mandatory and move the sessions there