fresh install, session problem

Technical Support
  • I am getting problems like:
    It looks like your login session is no longer active, or no longer matches with the server. Please refresh this page.
    We were unable to log you in, likely due to an expired session. Please try again.

    The thing is; when I try from my computer, Safari and Chrome does not give error; but Safari on my tablet or Chrome on my phone also give similar sesson problems.

    Setting are:

    Ubuntu 16.04; dedicated server; plesk panel; apache server, nginx proxy.

    CONFIG.JSON

    {
    "url": "https://forum.mydomain.com",
    "secret": "xxxxxxxx",
    "database": "mongo",
    "port": 4567,
    "mongo": {
    "host": "127.0.0.1",
    "port": "27017",
    "username": "nodebb",
    "password": "xxxxxxxxxx",
    "database": "nodebb"
    },
    "type": "literal"
    }

    ON PLESK PANEL:

    Additional nginx directives:

    location ~ / {

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
    proxy_set_header X-Forwarded-For $remote_addr;
    
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    
    proxy_pass http://127.0.0.1:4567;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    

    }

    Additional apache directives: none

    I have near zero knowledge about nginx settings; so I've copied all things that are advised in similar questions 🙂

    Thanks for your help.

  • the url in your config has to match the fqdn of your site. Also, I don't believe the https is necessary in that config as you are not using https in your nginx config.

    {
    "url": "http://the.exact.url",
    "secret": "xxxxxxxx",
    "database": "mongo",
    "port": 4567,
    "mongo": {
    "host": "127.0.0.1",
    "port": "27017",
    "username": "nodebb",
    "password": "xxxxxxxxxx",
    "database": "nodebb"
    },
    
  • But the site has a certificate from Letsencrypt. I mean, I need to run in https.

    What must I change?

  • aditional info:

    I have added to plesk settings:

    Additional Apache directives:

    Additional directives for HTTP : RequestHeader set X-Forwarded-Proto "http"
    Additional directives for HTTPS : RequestHeader set X-Forwarded-Proto "https"

    Additional nginx directives:
    CHANGED TO: proxy_set_header X-Forwarded-Proto https;

    But still problem persists:

    ./nodebb log
    2018-03-28T20:09:27.120Z [16310] - info: Initializing NodeBB v1.8.1 https://forum.mydomain.com
    2018-03-28T20:09:27.919Z [16310] - info: [socket.io] Restricting access to origin: https://forum.mydomain.com : *
    2018-03-28T20:09:28.053Z [16310] - info: Routes added
    2018-03-28T20:09:28.056Z [16310] - info: NodeBB Ready
    2018-03-28T20:09:28.059Z [16310] - info: Enabling 'trust proxy'
    2018-03-28T20:09:28.061Z [16310] - info: NodeBB is now listening on: 0.0.0.0:4567
    2018-03-28T20:14:37.264Z [16310] - error: /login
    invalid csrf token
    2018-03-28T20:15:56.745Z [16310] - error: /register
    invalid csrf token
    2018-03-28T20:18:01.983Z [16310] - error: /register
    invalid csrf token
    2018-03-28T20:18:06.767Z [16310] - error: /register
    invalid csrf token
    2018-03-28T20:20:12.421Z [16310] - error: /register
    invalid csrf token

  • @seyeran Whatever is in your config.json has to match the URL you are navigating to.

  • @teh_g said in fresh install, session problem:

    @seyeran Whatever is in your config.json has to match the URL you are navigating to.

    Thank you. I am really indebted to you. I was trying to solve it for the last 6-7 hours.

    Solution worked for me is this:
    Permanent 301 redirect from HTTP to HTTPS

  • Still, I have this problem!

    server {
        listen 80;
    
        server_name disnut.com;
    
        location / {
            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_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://127.0.0.1:4567;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    This is my NGINX Config

    0_1527224687271_Screenshot.png

  • same problem. any updates?

  • Ensure the config.json url matches the url you actually use to navigate to the forum.


Suggested Topics


  • 1 Votes
    3 Posts
    239 Views

    @baris thanks 🙏

  • 0 Votes
    6 Posts
    1k Views

    @sfchun said in nodeBB 1.8.2 ubuntu16.04.2 redis install from scratch:

    node app --setup

    I guess that was not the right step here.
    I copied the content of package.json from my running nodebb

    { "name": "nodebb", "license": "GPL-3.0", "description": "NodeBB Forum", "version": "1.8.2", "homepage": "http://www.nodebb.org", "repository": { "type": "git", "url": "https://github.com/NodeBB/NodeBB/" }, "main": "app.js", "scripts": { "start": "node loader.js", "lint": "eslint --cache ./nodebb .", "pretest": "npm run lint", "test": "nyc --reporter=html --reporter=text-summary mocha", "coveralls": "nyc report --reporter=text-lcov | coveralls && rm -r coverage" }, "dependencies": { "ace-builds": "^1.2.9", "async": "2.6.0", "autoprefixer": "7.2.4", "bcryptjs": "2.4.3", "benchpressjs": "^1.2.1", "body-parser": "^1.18.2", "bootstrap": "^3.3.7", "chart.js": "^2.7.1", "clipboard": "1.7.1", "colors": "^1.1.2", "commander": "^2.12.2", "compression": "^1.7.1", "connect-ensure-login": "^0.1.1", "connect-flash": "^0.1.1", "connect-mongo": "2.0.1", "connect-multiparty": "^2.1.0", "connect-redis": "3.3.3", "cookie-parser": "^1.4.3", "cron": "^1.3.0", "cropperjs": "^1.2.2", "csurf": "^1.9.0", "daemon": "^1.1.0", "diff": "^3.4.0", "express": "^4.16.2", "express-session": "^1.15.6", "express-useragent": "1.0.8", "graceful-fs": "^4.1.11", "helmet": "^3.11.0", "html-to-text": "3.3.0", "ipaddr.js": "^1.5.4", "jimp": "0.2.28", "jquery": "^3.2.1", "jsesc": "2.5.1", "json-2-csv": "^2.1.2", "less": "^2.7.3", "lodash": "^4.17.4", "logrotate-stream": "^0.2.5", "lru-cache": "4.1.1", "material-design-lite": "^1.3.0", "mime": "^2.2.0", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "mongodb": "2.2.33", "morgan": "^1.9.0", "mousetrap": "^1.6.1", "mubsub": "^1.4.0", "nconf": "^0.9.1", "nodebb-plugin-composer-default": "6.0.20", "nodebb-plugin-composer-redactor": "^3.2.0", "nodebb-plugin-dbsearch": "2.0.13", "nodebb-plugin-emailer-local": "0.2.1", "nodebb-plugin-embed-videos": "0.1.9", "nodebb-plugin-emoji": "^2.2.3", "nodebb-plugin-emoji-android": "2.0.0", "nodebb-plugin-emoji-extended": "1.1.1", "nodebb-plugin-emoji-one": "^2.0.0", "nodebb-plugin-imagemagick": "^2.0.5", "nodebb-plugin-imgbed": "1.0.2", "nodebb-plugin-markdown": "8.4.2", "nodebb-plugin-mentions": "2.2.4", "nodebb-plugin-poll": "^0.2.17", "nodebb-plugin-registration-question": "0.1.8", "nodebb-plugin-rss": "1.1.9", "nodebb-plugin-soundpack-default": "1.0.0", "nodebb-plugin-spam-be-gone": "0.5.3", "nodebb-plugin-sso-steam-v2": "2.0.1", "nodebb-plugin-topic-tags": "0.1.3", "nodebb-plugin-youtube-lite": "0.4.8", "nodebb-rewards-essentials": "0.0.11", "nodebb-theme-lavender": "5.0.4", "nodebb-theme-persona": "8.0.9", "nodebb-theme-slick": "1.2.1", "nodebb-theme-vanilla": "9.0.7", "nodebb-widget-advanced-essentials": "0.1.5", "nodebb-widget-essentials": "4.0.2", "nodemailer": "4.4.1", "passport": "^0.4.0", "passport-local": "1.0.0", "postcss": "6.0.15", "postcss-clean": "1.1.0", "promise-polyfill": "^7.0.0", "prompt": "^1.0.0", "redis": "2.8.0", "request": "2.83.0", "rimraf": "2.6.2", "rss": "^1.2.2", "sanitize-html": "^1.16.3", "semver": "^5.4.1", "serve-favicon": "^2.4.5", "sitemap": "^1.13.0", "socket.io": "2.0.4", "socket.io-adapter-mongo": "^2.0.1", "socket.io-client": "2.0.4", "socket.io-redis": "5.2.0", "socketio-wildcard": "2.0.0", "spdx-license-list": "^3.0.1", "spider-detector": "1.0.18", "toobusy-js": "^0.5.1", "uglify-es": "^3.3.9", "uglify-js": "^3.3.4", "validator": "9.2.0", "winston": "^2.4.0", "xml": "^1.0.1", "xregexp": "3.2.0", "zxcvbn": "^4.4.2" }, "devDependencies": { "coveralls": "^3.0.0", "eslint": "^4.14.0", "eslint-config-airbnb-base": "^12.1.0", "eslint-plugin-import": "^2.8.0", "grunt": "^1.0.1", "grunt-contrib-watch": "^1.0.0", "jsdom": "^11.5.1", "mocha": "^4.1.0", "mocha-lcov-reporter": "^1.3.0", "nyc": "^11.4.1", "smtp-server": "^3.4.1" }, "bugs": { "url": "https://github.com/NodeBB/NodeBB/issues" }, "engines": { "node": ">=6" }, "maintainers": [ { "name": "Andrew Rodrigues", "email": "[email protected]", "url": "https://github.com/psychobunny" }, { "name": "Julian Lam", "email": "[email protected]", "url": "https://github.com/julianlam" }, { "name": "Barış Soner Uşaklı", "email": "[email protected]", "url": "https://github.com/barisusakli" } ] }

    then run

    $ npm start > [email protected] start /var/www/mydomain.com > node loader.js 2018-04-19T07:47:44.529Z [450] - info: Launching web installer on port 4567 2018-04-19T07:47:44.931Z [450] - info: Web installer listening on http://0.0.0.0:4567

    Now everything is fine, but sadly I dont know how this file was originaly generated 😕 it seems it does not come from nodebb github repo ...

    At least I can continue !...

  • 0 Votes
    1 Posts
    573 Views

    Hi,

    i read in another post ( https://community.nodebb.org/post/53578 ) that you should be able to use node v6. Since i did not find anything related to which version some should use.

    The current Dockerfile suggest using v4 but the file was updated long time ago.

    The docs also do not really say which version some should use (at least i didnt find it here: https://docs.nodebb.org/en/latest/installing/os/debian.html). Since the docs are mentioning wheezy i suspect they are outdated too.

    I would suspect using v6 would be fine since this is the latest LTS now. Which version should is use?

    Best wishes,
    lycano

  • 0 Votes
    5 Posts
    3k Views

    @Waqass-Khalid

    As of date is it the only option available? shared hosting still not possible?

    Not unless the shared hosting provider gives you some command line access and will let you install nodejs, and run several npm commands. Plus they have to have MongoDB or Redis access for database. 😛 Most shared hosting providers don't have the software necessary for running nodebb, and they won't let you install it.

  • Invalid session

    Technical Support
    0 Votes
    23 Posts
    9k Views

    Honestly? The purpose of cookiedomain is to let you "genericise" the NodeBB cookie so you can read it (and its session) in another app sharing the same express secret. It's useful, but 99.999% of admins probably don't use it, and setting it can definitely cause problems.