Install NodeBB on subfolder
-
HI @PitaJ ,
I don't want any redirection. For SEO purposes, I would like to keep everything within domain.com (ie: forum becomes domain.com/forum). I think the main issue is why the websock (socket.io) stops working when I install NodeBB on subfolder.
Thanks!
-
@Mickola then redirect
forum.domain.com
todomain.com/forum
.The following topic may help with the socket error:
[FAQ] Websockets not working due to misconfigured origins
This FAQ is applicable for the following situations: You're receiving the following error in the Javascript console: WebSocket connection to 'wss:///socket...
NodeBB Community (community.nodebb.org)
-
@PitaJ, I saw that topic Re: Websocket error and already applied the suggestion as you can see from config.json.
The issue is, NodeBB is working when I put domain.com as the URL. As soon as I add a subfolder - domain.com/forum - it stops working and gives me 404 error (socket.io). Is there any missing configurations from my config.json and NGINX config?
-
@julian & @PitaJ , thanks for your suggestion, it works now. I can access forum.domain.com/forum. The funny thing is nothing really changes from my original settings. I tested using Firefox and I don't see any 404 error, however, Chrome still shows the same error. But if I open it in Incognito mode, the error disappears.
Anyway, I still haven't been able to tackle the main issue. The objective is I like to run the nodeBB on subfolder of my Wordpress site. Since they're physically in different server (WP Engine for Wordpress site and Google Cloud for NodeBB), do you have any suggestions on how to achieve it?
Originally, I thought Cloudflare can solve the issue (See this article: https://blog.cloudflare.com/subdomains-vs-subdirectories-improved-seo-part-2/). So, I followed the steps, and managed to have domain.com/forum proxies traffic to forum.domain.com/forum. All the CSS, JS and images are loaded properly, as well as all the links (to the forum, categories, posts, etc.).
The issue is always on websocket, I keep getting 404 not found on socket.io - even after applying what @julian suggested (adding domain.com/forum to origins). Any ideas?
-
@julian and @PitaJ ,
I guess there's a small progress. Now, instead of 404 error, I get 403 forbidden when accessing socket.ioI change config.json url value to either: forum.domain.com/forum or domain.com/forum based on https://github.com/NodeBB/NodeBB/issues/5791
{ "url": "https://domain.com/forum/", "secret": "123", "database": "mongo", "port": "4567", "mongo": { "host": "127.0.0.1", "port": "27017", "database": "nodebb" }, "socket.io": { "origins": "https://forum.domain.com/forum:* https://forum.domain.com:* https://domain.com/forum:* https://domain.com:*" } }
Any directions?
-
First: try adding
https://domain.com:*
, nothttps://domain.com/forum
to your socket.io config.I think it's likely that the cloudflare forwarding won't work with websockets.
I think you have two options:
-
Install both Wordpress and NodeBB on the same server. This shouldn't be too difficult, Wordpress is not very resource intensive. Then you can use nginx to handle both.
-
Run NodeBB under a subdomain.
I don't recommend this but it may be possible to reverse proxy between the two servers. Either WP -> NBB or NBB -> WP. I'd recommend you have https when communicating between the two servers.
-
-
-
@julian I was suggesting installing his own WordPress setup on the same server as NodeBB, which is entirely possible but not easy by any means.
-
@julian, if you see my config.json, https://domain.com : * is already there.
Well, I guess the best option is to put the Wordpress site on the same server as NodeBB. I don't think it's going to be this complicated ;). Thanks for your help, @julian & @PitaJ