Skip to content

[Bug]: Login session not stored, server returned 400 #237

@Kabelkrant

Description

@Kabelkrant

Description

My login session with Bulwark is not stored in my browser, both with Firefox and Chrome. Every time I come back, the session has been expired and I have to login again.

Bulwark is running in Docker, behind a NGINX reverse proxy.

The SESSION_SECRET environment variable is provided to the container, generated with openssl rand -base64 32.

The Firefox Console reports:
Failed to store session: server returned 400
and
Settings sync failed: Identity mismatch

There is only 1 cookie with the name DeviceId.

Steps to Reproduce

  1. Go to Bulwark, check 'Remember me', and login.
  2. Close the tab
  3. Visit the Bulwark webmail URL again.
  4. The login screen with the message 'Your session has expired. Please sign in again.' is presented

Expected Behavior

To go directly to the inbox.

Actual Behavior

The login screen with the message 'Your session has expired. Please sign in again.' is presented

Bulwark Version

1.5.3

Stalwart Mail Server Version

0.16.2

Browser

Firefox 150.0
Chrome 147.0.7727.119

Operating System

Windows 11

Screenshots / Screen Recording

No response

Relevant Logs or Error Output

Firefox developer tools console:

[ERROR] Failed to store session: server returned 400 [3718-6cf8e01f8fd92f9f.js:1:688](https://webmail.onderzone.nl/_next/static/chunks/3718-6cf8e01f8fd92f9f.js)
    NextJS 2

and

[SETTINGS_SYNC] Settings sync failed: Identity mismatch [3718-6cf8e01f8fd92f9f.js:1:1616](https://webmail.onderzone.nl/_next/static/chunks/3718-6cf8e01f8fd92f9f.js)
    NextJS 2

Docker log:

webmail  | ▲ Next.js 16.2.4
webmail  | - Local:         http://localhost:3000
webmail  | - Network:       http://0.0.0.0:3000
webmail  | ✓ Ready in 0ms
webmail  | Bulwark Webmail v1.5.3
webmail  | [INFO ] 2026-04-30T12:36:50.703Z Admin dashboard enabled (password loaded from admin.json)
webmail  | Admin dashboard initialized
webmail  | [INFO ] 2026-04-30T12:36:50.736Z telemetry: scheduler not started {"consent":"off"}

Additional Context

NGINX-config:

server {
  listen 80;
  listen [::]:80;
  listen 443 quic;
  listen 443 ssl;
  listen [::]:443 quic;
  listen [::]:443 ssl;
  http2 on;
  http3 off;
  ssl_certificate_key /etc/nginx/ssl-certificates/webmail.onderzone.nl.key;
  ssl_certificate /etc/nginx/ssl-certificates/webmail.onderzone.nl.crt;
  server_name webmail.onderzone.nl;
  root /home/onderzone-webmail/htdocs/webmail.onderzone.nl;

  access_log /home/onderzone-webmail/logs/nginx/access.log main;
  error_log /home/onderzone-webmail/logs/nginx/error.log;

  if ($scheme != "https") {
    rewrite ^ https://$host$request_uri permanent;
  }

  location @reverse_proxy {
        proxy_pass http://10.0.20.3:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
  }


  include /etc/nginx/global_settings;

  add_header Cache-Control no-transform;

  index index.html;

  location ^~ /.well-known {
    auth_basic off;
    allow all;
    try_files $uri @reverse_proxy;
  }

  location / {
    try_files $uri @reverse_proxy;
  }
}

docker-compose:


services:
  webmail:
    image: ghcr.io/bulwarkmail/webmail:latest
    container_name: webmail
    ports:
      - 3000:3000
    environment:
      JMAP_SERVER_URL: https://mail.onderzone.nl
    volumes:
      - ./settings:/app/data/settings
      - ./admin:/app/data/admin
    restart: unless-stopped
    env_file:
      - .env
networks: {}

.env:

APP_NAME=Onderzone Mail
FAVICON_URL=/branding/extern/webmail.svg
LOGIN_LOGO_LIGHT_URL=/branding/extern/webmail.svg
LOGIN_LOGO_DARK_URL=/branding/extern/webmail.svg
SESSION_SECRET=nEkmvLqTfWZYIZ**(....etc,redacted)**
SETTINGS_SYNC_ENABLED=true
STALWART_FEATURES=true
ADMIN_PASSWORD=**(redacted)**
BULWARK_TELEMETRY=off

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions