Unable to login after domain change
-
Hi, as the title says, I can't login after I changed the domain.
Interestingly, not even when I sign up with a different account I can't login. Not even when the user is redirected after sign up.
Any ideas what could cause this?And the message is:
We were unable to log you in, likely due to an expired session. Please try again
-
Did you change the url value in config.json ?
-
Everyone will have to log back in. Beyond that, not much.
-
Looks like this domain stuff is a dead end for me.
I've tried to setup NodeBB on a subdomain with the help of a proxy.
There was a sockets problem when accessing it with the proxy and I gave up.I thought that if I place NodeBB on its own domain everything will be okay.
Unfortunately it works locally, but when uploaded to Heroku I can't login anymore due csrf-invalid error.So I have to give up
-
@george_i,
I had similar issues when switching between local and Heroku environments.Not only should you change the config.json value, you should try changing the cookie value in the config object in the database. Here is the mongodb query:
db.getCollection('objects').find({'_key': 'config'})
In there you will find a property called "cookieDomain".
It's value should be "" if localhost, or ".yourdomain.com" when on Heroku using a custom domain. -
@GarrettBryan thanks for suggestion, but it didn't worked.
The field was missing and even adding it, nothing changed. -
@george_i what is your proxy setup? Which one are you using and what is your config?
-
{ "url": "https://hhub.online", "secret": "some-secret", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": 27017, "username": "", "password": "", "database": "nodebb", "uri": "mongodb://user:[email protected]:port/db" }, "port": "4567" }
I'm not using any proxy, because Heroku supplies already custom domains and is used by Cloudflare.
-
I'm afraid I know nothing about heroku. Wish I could help more.
-
@george_i
That seems odd that it is missing.
I followed the Heroku walkthrough with success.
I had problems with Heroku's ephemeral filesystem. I had to install and build and commit plugins locally, then push the commit to Heroku. The filesystem resets to the latest commit everytime the dyno restarts.What size dyno are you using?
@PitaJ
Is it possible that that field can go missing? I'm new to NodeBB. Do all documents in the Mongo database have a schema? -
@GarrettBryan it works fine when on
hhub4.herokuapp.com
localhost:4567
But when I add custom domain as in the picture below and proxying with Cloudflare tohttps://hhub.online
, I get that csrf-invalid.
-
@george_i
I'm not too sure about how to set up cloudflare.
I use NameCheap for DNS services. I'm using CNAME records.
I only have a single domain configured.Have you attempted one domain at a time?
-
@GarrettBryan the domain is correctly routed.
The only problem is at login/registration.
And I tried with the domain only too.I wonder if is not a problem with the server time @PitaJ
Initially I login on localhost, which works correctly.
Then on Heroku could fail because the server is on a different time zone?