Excuse me, how to set a nodebb two domain address.
-
Domain 1: abc.com
Domain 2: abc.net
I hope they all point to the same nodebbThe first domain name is set and can be used normally.
How can the second domain be coexisted with the first domain?
I can't find a discussion in google, and there is no answer to the help documentation. I use nginx, please. -
Both domains should have
A
records that point to the same IP address. Nginx on the server will have:server_name abc.com abc.net;
Both urls should load NodeBB now (though the non-canonical URL will have a socket.io error).
Edit your config.json and add:
{ ... "socket.io": { "origins": "https://abc.com:* https://abc.net:*" } ... }
I think it is space-separated...
-
More discussion here:
https://community.nodebb.org/topic/13388/faq-websockets-not-working-due-to-misconfigured-origins
There's another issue using two domains: you'll actually have to have separate nginx blocks for each because they can't share a TLS certificate.
The real question is why not just redirect one domain to the other?
-
@ufan0 that doesn't work, it doesn't actually use both URLs. It only uses the second one. JSON allows having multiple instances of the same key, but JavaScript doesn't work that way.