Mattermost Behind Nginx and Cloudflare Script Load Error
-
Mattermost sitting behind Nginx and Cloudflare. I get this error on the web console:
Loading failed for the <script> with source “https://ajax.cloudflare.com/cdn-cgi/scripts/7089c43e/cloudflare-static/rocket-loader.min.js”.
I've found this mentioned in the MM logs online, but without any resolution. My guess is that maybe I need to override this using an Nginx rewrite? MM has a setting that is supposed to fix this, but does not.
-
According to Mattermost, this setting is supposed to fix this problem, but does not:
"AllowCorsFrom": "*",
-
If I disable RocketLoader, everything works, of course. But it would be nice to not have to do that.
-
Is your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
Does it work if Cloudflare is setup as dns only instead?
-
@black3dynamite said in Mattermost Behind Nginx and Cloudflare Script Load Error:
s your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
CF Proxy > Nginx Proxy > Mattermost (MM is its own server)
And yes, if I disable the CF Proxy, it works.
-
@scottalanmiller said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@black3dynamite said in Mattermost Behind Nginx and Cloudflare Script Load Error:
s your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
CF Proxy > Nginx Proxy > Mattermost (MM is its own server)
And yes, if I disable the CF Proxy, it works.
Why the double reverse proxies?
-
@Pete-S said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@scottalanmiller said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@black3dynamite said in Mattermost Behind Nginx and Cloudflare Script Load Error:
s your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
CF Proxy > Nginx Proxy > Mattermost (MM is its own server)
And yes, if I disable the CF Proxy, it works.
Why the double reverse proxies?
That's the standard. You are always expected to have your node.js servers behind a reverse proxy. And CloudFlare is the CDN cache in front. This is the universal standard for all web servers. Plenty of times to avoid it, of course, but this is the baseline system design.
In this case, MM is a raw node server so has none of the protections or handling of a system like Nginx. Nginx also provides the ability to have multiple sites behind one IP address. MM doesn't do that on its own, nor does CloudFlare. No different than how MangoLassi is on NodeBB, also a node platform, behind Nginx, behind CloudFlare.
CF can't do the details port and IP handling, Nginx can't do the globally distributed cache.
-
@scottalanmiller said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@Pete-S said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@scottalanmiller said in Mattermost Behind Nginx and Cloudflare Script Load Error:
@black3dynamite said in Mattermost Behind Nginx and Cloudflare Script Load Error:
s your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
CF Proxy > Nginx Proxy > Mattermost (MM is its own server)
And yes, if I disable the CF Proxy, it works.
Why the double reverse proxies?
That's the standard. You are always expected to have your node.js servers behind a reverse proxy. And CloudFlare is the CDN cache in front. This is the universal standard for all web servers. Plenty of times to avoid it, of course, but this is the baseline system design.
In this case, MM is a raw node server so has none of the protections or handling of a system like Nginx. Nginx also provides the ability to have multiple sites behind one IP address. MM doesn't do that on its own, nor does CloudFlare. No different than how MangoLassi is on NodeBB, also a node platform, behind Nginx, behind CloudFlare.
CF can't do the details port and IP handling, Nginx can't do the globally distributed cache.
Thanks for the clarification Scott. I (wrongly) thought that Cloudflare was a full featured proxy and could do the same job as haproxy, nginx etc.