Error 500 | ERR_CONNECTION_CLOSED with Cloudflare

(Diego Barreiro) #1

I got a fresh VPS for my Discourse instance with these specs:

RAM:  2  GB
vCPU: 1  Core
SDD:  40 GB
OS:   CentOS 7

The domain is passed through Cloudflare

Accessing through the configured domain gives ERR_CONNECTION_CLOSED error:

Accessing through IP directly gives Error 500:

(Diego Barreiro) #2

First production.log showed the Redis Connection Refused error
I installed and started the redis service manually

Now I get this:

Completed 500 Internal Server Error in 3900ms (ActiveRecord: 392.1ms)
ActionView::Template::Error (undefined local variable or method `render_google_analytics_code' for #<#<Class:0x00007fcce7ebc9c0>:0x00007fcce54693d0>
Did you mean?  render_google_universal_analytics_code)
/var/www/discourse/plugins/discourse-branding/app/views/layouts/application.html.erb:115:in `_plugins_discourse_branding_app_views_layouts_application_html_erb__470741929770803549_70258981163020'

(Jeff Atwood) #3

Something is deeply wrong with your setup and/or DNS. I don’t even recognize that other “Oops” message. Turns out that is the 500 error page default text, so that is indeed Discourse at least.

(Diego Barreiro) #4

Check the error I posted right now:

(Jeff Atwood) #5

Your config is really, really broken. I would start over from scratch. Are you following our official install docs, to the letter – and not deviating in any way on any step? Also don’t add any third party plugins.

(Diego Barreiro) #6

Yeah, I’ve done twice today, following the docker starter guide

And this is not the first time I deploy Discourse Forum System, I don’t know what’s happening
I never had a problem like this

(Diego Barreiro) #7

Okey, I’m going to reset the VPS and start again…

(Diego Barreiro) #8

The Error 500 (Oops) is caused by a plugin, I’ll try to find which one
Without any plugin it’s working perfectly, after importing my list doesn’t work. Probably it doesn’t happen on my normal community because they aren’t up to date

The ERR_CONNECTION_CLOSED is releated with Cloudflare, definitely
I’ve set the “grey cloud” and it’s working now

(Diego Barreiro) #9

Any idea why this happens?
I still get it :confused:. And I need to provide access through the domain, as you can suppose

(Diego Barreiro) #10

I’ve found the reason for the ERR_CONNECTION_CLOSED:

Taken from Cloudflare:

You’re accessing a subdomain not covered by the Cloudflare-issued SSL certificate
Cloudflare-issued SSL certificates cover the root-level domain (eg- and one level of subdomains (eg- * If you’re attempting to access a second level of subdomains (eg- through Cloudflare using the Cloudflare-issued certificate, a HTTP 403 error will be seen in the browser as these host names are not present on the certificate. If you need to have SSL working for these type of host names you would either need to purchase a Dedicated Certificate with Custom Hostnames through Cloudflare, purchase your own SSL cert and upload it to us as a Custom SSL Certificate or grey-cloud this DNS record so the traffic goes directly to your origin server.

I was using this subdomain: and as you can see it has a double subdomain, which isn’t supported by Cloudflare Free plan
In order to support those subdomains it’s required a paid plan