Skip to content

CSRF token validation fails when Parse Dashboard runs behind a load balancer without sticky sessions #3015

@badboy-tian

Description

@badboy-tian

New Issue Checklist

Issue Description

When Parse Dashboard is deployed with multiple replicas behind a load balancer that does not provide sticky sessions, login attempts fail with the CSRF error message “CSRF token validation failed. Please refresh the page and try again.” The issue disappears immediately when all requests are routed to a single replica.

Steps to reproduce

  1. Deploy Parse Dashboard (npm package parse-dashboard 8.0.0) together with Parse Server behind Traefik Ingress in a Kubernetes (k3s) cluster.
  2. Set the Parse Dashboard deployment replica count to 2 and use a load balancer without sticky sessions (round-robin).
  3. Access https://<host>/dashboard/login, enter a configured username and password, then submit the form.
  4. Observe the 403 response and the CSRF error message. Refreshing the page sometimes succeeds because the next request may hit the same pod.

Actual Outcome

  • Browser shows CSRF token validation failed. Please refresh the page and try again. after submitting the login form.
  • Dashboard pod logs contain EBADCSRFTOKEN entries.

Expected Outcome

  • Login should succeed, or official documentation should explicitly state that Parse Dashboard requires sticky sessions or a shared session store when running multiple replicas.

Environment

Dashboard

  • Parse Dashboard version: 8.0.0
  • Browser (Safari, Chrome, Firefox, Edge, etc.): Safari 18.1 / Chrome 129
  • Browser version: Safari 18.1 (macOS 15.1) / Chrome 129.0.6668.90

Server

  • Parse Server version: 8.4.0
  • Operating system: Alpine Linux (container)
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Self-hosted k3s cluster

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 6.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Self-hosted MongoDB service

Logs

Relevant snippet with VERBOSE=1:

[error] CSRF token mismatch: EBADCSRFTOKEN (login POST)

If the deployment is scaled down to 1 replica or sticky sessions are enabled (Traefik sticky cookie or Kubernetes sessionAffinity: ClientIP), the issue no longer occurs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions