Getting a session mismatch every time the page reloads.

General Discussion
  • I'm getting a session mismatch error every time the page reloads. It's impossible to login to my forum.

    • Check in config.json that the url of your forum matches exectly the domain url you are using
    • Disable nginx routing for a test and access your forum directly to see if it helps
    • If you use Cloudfare disable Cloudfare distribution unless you have a higher plan which allows websockets
    • Check with/without firewall
    • I did a manual socket.io npm re-install which may have fixed something, too

    I have been trough this frustrating experience for days but in the end got it all sorted. Its quite a bit of learning to get it working but in the end it all makes sense.

  • The common causes for a session mismatch error are usually one of the following:

    1. Mis-configured URL parameter in your config.json file

    If you have a misconfigured url value in your config.json file, the cookie may be saved incorrectly (or not at all), causing a session mismatch error. Please ensure that the link you are accessing your site with and the url defined match.

    2. Improper/malformed cookieDomain set in ACP

    Sometimes admins set this value without realising that they probably don't need to set it at all. The default is perfectly fine. This is what the config looks like:

    Cookie Domain setting

    If this is set, you'll want to revert the setting by editing your database directly:

    Redis: hdel config cookieDomain
    MongoDB: db.objects.update({ _key: "config" }, { $set: "cookieDomain": "" });

    3. Missing X-Forwarded-Proto header from nginx/apache

    If you are using a reverse proxy, you will need to have nginx pass a header through to NodeBB so it correctly determines the correct cookie secure property.

    In nginx, you will need to add the directive like so:

    location / {
        ...
        proxy_set_header X-Forwarded-Proto $scheme;
        ...
    }
    
  • @julian after trying to set cookiedomain in MongoDB with your command I get:

    2018-05-31T16:16:42.444+0000 E QUERY [thread1] SyntaxError: missing } after property list @(shell):1:60

  • db.objects.update({ _key: "config" }, { $set: { "cookieDomain": "" } });

    My bad, forgot some curly braces 馃檪


Suggested Topics


  • How to get uid from @userslug?

    Solved General Discussion
    0 Votes
    8 Posts
    526 Views

    @baris very thanks
    This is the JS code I write for new chat with users, thanks to the help you give me

    require(['autocomplete'], autocomplete => { var modal = bootbox.dialog({ title: '[[flags:start-new-chat]]<i class="fa fa-comments-o" style="margin: 0 7px;"></i>', message: '<input class="form-control input-lg" placeholder="[[user:username]]">', buttons: { cancel: { label: '[[modules:bootbox.cancel]]', className: 'btn-default', callback: () => modal.modal('hide') }, ok: { label: '[[modules:bootbox.ok]]', className: 'btn-primary', callback: () => false } }, onEscape: true, backdrop: true, show: true }); modal.on('shown.bs.modal', () => { var inputEl = modal.find('input'); inputEl.focus(); autocomplete.user(inputEl); modal.find('.btn-primary').click(() => { utils.isUserNameValid(inputEl.val()) ? require(['slugify'], slugify => $.getJSON(`/api/user/${slugify(inputEl.val())}`, data => { app.newChat(data.uid); if (app.user.uid != data.uid) modal.modal('hide'); }).catch(() => app.alertError('[[error:no-user]]')) ) : app.alertError('[[error:invalid-username]]') }); }); });
  • 0 Votes
    3 Posts
    2k Views

    @baris Thanks for adding the additional areas!

  • 0 Votes
    1 Posts
    147 Views

    Hello all,

    I am using NodeBB 1.16.2 with Oxide theme. No other plugins except the ones that came with the installation. Every time I call a page I get the following 404 message in the nginx log:

    178.xxx.xxx.xxx - - [09/Apr/2021:10:52:02 +0000] "GET /assets/src/client/footer.js?v=4u8ga71iu38 HTTP/2.0" 404 9 "https://xxxx.xx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0"

    I just can't find the appropriate call to it though:

    # locate footer.js /var/www/nodebb/build/public/templates/admin/footer.js /var/www/nodebb/build/public/templates/admin/partials/settings/footer.js /var/www/nodebb/build/public/templates/emails/partials/footer.js /var/www/nodebb/build/public/templates/footer.js /var/www/nodebb/install/data/footer.json /var/www/nodebb# grep -R "footer.js" * CHANGELOG.md:* add partials/footer/js.tpl (94da9fe5) node_modules/nodebb-theme-vanilla/templates/footer.tpl: <!-- IMPORT partials/footer/js.tpl --> node_modules/nodebb-theme-persona/templates/footer.tpl: <!-- IMPORT partials/footer/js.tpl --> src/install.js: fs.promises.readFile(path.join(__dirname, '../', 'install/data/footer.json'), 'utf8'),

    Can someone please help me or point me in the right direction? I am unfortunately a newbie in the NodeBB area. Thanks!

    Translated with www.DeepL.com/Translator (free version)

  • personal page eror

    General Discussion
    0 Votes
    10 Posts
    274 Views

    thank.
    not runnig

  • 1 Votes
    12 Posts
    4k Views

    @frissdiegurke either that or text complete can be a standalone plugin that other plugins can add stuff into.