You can't get the current user data without their uid. If you have access to the express req object you can grab it with req.uid or if it is a socket call then its socket.uid. The value of uid is 0 if the user is not logged in.
SOLVED How can I run nodebb on 2 urls?
@pitaj maybe it is because there are TWO server blocks in the nginx config, and both of them point towards 127.0.0.1:4567. But i suppose it doesn't really make a difference then in the config.json, does it?
@pitaj I've got it working now and I don't have the config.json handy right now. but it looked something like this:
"url" : "forum.url1.com" "url" : "forum.url2.com" the rest of the config
@dunlix session sharing shouldn't have anything to do with it. My guess is you put community second, so that is used as the URL, and it always works because it isn't blocked.
There might be some caching going on or you're running multiple instances or something. Without access to the sites I can't confirm anything.
@pitaj also, I am definitely not running multiple instances because I always leave the log open so never use the console to start.
@dunlix a few problems
Certificate mismatch for unblocked. Suggest having a separate cert for each subdomain.
Your http -> https redirect isn't working for unblocked.
I get a security error for both (even after bypassing the TLS mismatch error). Looks like your server is set up for an outdated version of TLS.
Also it looks like your URL in config.json has http instead of https.
Right now I can't access your sites because of the errors.
@dunlix it doesn't work on Firefox, Chrome, or Edge on my computer. On my phone, it doesn't work in Firefox, but it does work in Chrome.
Error in Firefox on my phone:
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified. Please contact the website owners to inform them of this problem.
Websites prove their identity via certificates. Firefox Nightly does not trust https://forum.gggrealms.ml/ because its certificate issuer is unknown, the certificate is self-signed, or the server is not sending the correct intermediate certificates.
Error in Firefox on my computer:
In this topic I made you should see the emoji image doesn't load. That's because it's trying to load from
http://unblocked.gggrealms.ml/plugins/nodebb-plugin-emoji/emoji/customizations/ea9804b2-6c62-4ca1-b8b4-0d79bd12eb10-touchicon-orig.pngwhich I think the browser blocks.
It's loading from there because that's your url in config.json
Keng Her last edited by
Just a thought.... For internal use you can do whatever you want, but if you're publishing these urls onto the web I don't understand why you would seek this. It would be much simpler to just keep it in one URL and do a redirect from the other URL. Also it's bad for SEO if you have two urls pointing to the same forum generating "duplicate" content.
Maybe you can enlighten me.
I believe I made myself clear in this reply @Keng-Her.
Anyway I’ve got this working as I marked it solved.
@pitaj The second one definitely does not override it, because both work now. In some of my scenarios, my forum is blocked because it is categorized as a forum (FORUM.url) so a separate url works then. If it redirects then you know what will happen, it will still be blocked