SOGo Logout button only destroys Mailcow session (MCSESSID), leaving SOGo session (0xHIGHFLYxSOGo) active — user lands on SOGo login form instead of Mailcow

Author: MarchenkoOlegCreated Jul 25, 2026Updated Sep 23, 2026
Labelsstale

SOGo "Logout" button only destroys the Mailcow session, leaving the SOGo session (0xHIGHFLYxSOGo) active — user lands on SOGo's own login form instead of the Mailcow login page

Summary

The stock mc_logout() shipped in custom-sogo.js only calls Mailcow's logout (POST / with logout=1), which destroys the MCSESSID session. SOGo, however, maintains a separate session in the cookie 0xHIGHFLYxSOGo, independent of the Mailcow SSO session. After clicking "Logout" (the settings_power button in UIxTopnavToolbar.wox), the Mailcow session is gone but the SOGo session is still alive, so the user lands on SOGo's own login form rather than the Mailcow login page — defeating single sign-on.

Environment

  • Mailcow commit: 809bbae1 (2026-07-16 update)
  • ghcr.io/mailcow/sogo:5.12.9-1
  • ghcr.io/mailcow/nginx:1.30.3-1

Root cause

custom-sogo.js (shipped in the image, see WebServerResources/js/custom-sogo.js) currently reads:

javascript
function mc_logout() {
    fetch("/", {
        method: "POST",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        body: "logout=1"
    }).then(() => window.location.href = "/");
}

This clears MCSESSID only. The SOGo session cookie 0xHIGHFLYxSOGo is untouched, so when the browser is sent to /, nginx's SOGo SSO auth_request re-authenticates against the still-valid SOGo session / the user is bounced back into SOGo's native auth surface, and SOGo renders its own login form.

The disconnect button is wired in Templates/UIxTopnavToolbar.wox:

xml
<md-button class="md-icon-button"
           onclick="mc_logout();"
           var:ng-click="navButtonClick"
           ng-href="#">
  <md-icon>settings_power</md-icon>

SOGo has a native signout that does clear the cookie

GET /SOGo/so/signout returns a proper session discard:

http
HTTP/2 200
set-cookie: 0xHIGHFLYxSOGo=discard; expires=<past>; path=/SOGo/

Steps to reproduce

  1. Log into Mailcow at https://<host>/, get redirected into SOGo via SSO.
  2. In SOGo, click the disconnect (settings_power) button in the top toolbar.
  3. Observe: the page shows SOGo's own login form (the SOGo logo / SOGo login inputs), not the Mailcow login page.

Expected: the Mailcow login page (/). Actual: SOGo's native login form.

Workaround

Update mc_logout() to first hit SOGo's native signout (clears 0xHIGHFLYxSOGo) and then perform the Mailcow logout:

javascript
function mc_logout() {
    var sogoSignout = fetch("/SOGo/so/signout", {
        method: "GET",
        credentials: "include",
        redirect: "manual"
    }).catch(function () { return new Response(); });

    sogoSignout.then(function () {
        return fetch("/", {
            method: "POST",
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            body: "logout=1",
            credentials: "include",
            redirect: "manual"
        }).catch(function () { return new Response(); });
    }).then(function () {
        window.location.href = "/";
    });
}

After this, "Logout" → Mailcow login page (/, HTTP 200), as expected.

Note: editing data/conf/sogo/custom-sogo.js alone is not sufficient to take effect due to the issue reported separately (per-file bind mounts shadowed by sogo-web-vol-1); the file also needs to land in the volume that nginx serves. Please treat the two issues as related.

Suggested fix

Ship mc_logout() that clears both sessions (SOGo via /SOGo/so/signout, Mailcow via POST / logout=1) in the default custom-sogo.js.

Source: mailcow/mailcow-dockerized