Discourse site loads via IP but via domain only header

Have you checked the error console in your browser for hints as to how it’s failing?


Yes, there are a few errors such as this

“Uncaught ReferenceError: jQuery is not defined”

Could you please post ALL of the errors? By the time we get to the error you posted, there’s probably already been multiple significant errors that caused this one.

Thanks for your time, exporting the error list brings up the following:

ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js:6 Uncaught SyntaxError: Invalid or unexpected token
_preload-store-ec90ffab9d7a6d9e507dda7cf7343e9d50b8bce624f7f44486ac8fd6b9814309.js:1 Uncaught TypeError: define is not a function
    at _preload-store-ec90ffab9d7a6d9e507dda7cf7343e9d50b8bce624f7f44486ac8fd6b9814309.js:1
vendor-957bcfd0b1422c19974dcf8f64f73eeada523e3d12dd3c76eb24c753f9399397.js:1 Uncaught ReferenceError: Ember is not defined
    at vendor-957bcfd0b1422c19974dcf8f64f73eeada523e3d12dd3c76eb24c753f9399397.js:1
    at vendor-957bcfd0b1422c19974dcf8f64f73eeada523e3d12dd3c76eb24c753f9399397.js:1
vendor-957bcfd0b1422c19974dcf8f64f73eeada523e3d12dd3c76eb24c753f9399397.js:1 Uncaught ReferenceError: $ is not defined
    at window.onerror (vendor-957bcfd0b1422c19974dcf8f64f73eeada523e3d12dd3c76eb24c753f9399397.js:1)
_pretty-text-bundle-1ffc769a242112508cf55cebf48084d3d074ec9376e7448676acd524a027b1d6.js:1 Uncaught TypeError: define is not a function
    at _pretty-text-bundle-1ffc769a242112508cf55cebf48084d3d074ec9376e7448676acd524a027b1d6.js:1
application-2d07fc19aa7165b0fc0c3b985a2b90f6cf72cc5f4420ad8626f14626e15a049e.js:8 Uncaught SyntaxError: Unexpected end of input
_plugin-e206a6cff2124b943dc0420347fa41f9e92d28b8100c0e7be64b7f5a2705bfe5.js:58 Uncaught ReferenceError: jQuery is not defined
    at _plugin-e206a6cff2124b943dc0420347fa41f9e92d28b8100c0e7be64b7f5a2705bfe5.js:58
_preload-application-data-0a59ccab480941aaac91f9e7fa7f77496323ae056aaa4158822dea35de319c01.js:2 Uncaught ReferenceError: require is not defined
    at _preload-application-data-0a59ccab480941aaac91f9e7fa7f77496323ae056aaa4158822dea35de319c01.js:2
    at _preload-application-data-0a59ccab480941aaac91f9e7fa7f77496323ae056aaa4158822dea35de319c01.js:66

Not to bother you but did you have a chance to review this?

Looks like this file is corrupt - if you look at the file is there anything obvious?

Have you tried rebuilding?

I have tried rebuilding and updatting, same problem unfortunately

After looking at the .js file in question, I see that it’s truncated and my browser is throwing networking errors to the console.

This is probably caused by using CloudFlare - we have seen enough problems using CloudFlare that we recommend disabling it entirely if possible.

This particular error seems to be on CloudFlare’s end as my browser also threw various non-source related errors downloading the file such as:

GET https://forum.example.com/assets/ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js net::ERR_SPDY_PROTOCOL_ERROR 200

And it even errored on the command line:

○ → wget https://forum.example.com/assets/ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js
--2018-12-20 16:30:10--  https://forum.example.com/assets/ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js
Resolving forum.example.com (forum.example.com)...,
Connecting to forum.example.com (forum.example.com)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/javascript]
Saving to: ‘ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js’

ember_jquery-07f49b     [ <=>                ] 160.87K  --.-KB/s    in 0.03s   

2018-12-20 16:30:11 (4.62 MB/s) - Read error at byte 164729 (Success).Retrying.

--2018-12-20 16:30:12--  (try: 2)  https://forum.example.com/assets/ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js
Connecting to forum.example.com (forum.example.com)||:443... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

I would recommend disabling CloudFlare entirely here if possible; if not, search meta for recommendations on disabling all of CloudFlare’s optimizations.


You’ll need an SSL certificate; I recommend following the Setting up HTTPS support with Let's Encrypt guide to get a free SSL certificate for your site.

First though, you ought to verify that the ember_jquery.js file is complete when loaded directly from the IP instead of via CF.

1 Like

OKay site now is off cloudflare however still just the header.

The file is loaded correctly over the IP, no errors at all. I moved off cloudflare now but still experiencing the same issue

There is something very wrong with your setup such causing it to return truncated files.

A comparison of the file downloaded from your site with the same version of the file present on another site (found by searching for that asset version) shows the same content right up until when yours gets truncated around 25% of the way into the file:

○ → diff -u <(sed -e 's/;/;\n/g' < guapic_ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js) <(sed -e 's/;/;\n/g' < elixir_ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js) | head
--- /dev/fd/63	2018-12-20 18:21:35.589330942 -0500
+++ /dev/fd/62	2018-12-20 18:21:35.589330942 -0500
@@ -1268,4 +1268,3443 @@
 return!1===l?["expr",n]:l}if(void 0!==a){var u=this.funcs[a],l=u(r,i,o,t);
 F(On,new An);
-var Sn=["javascript:","vbscript:"],Tn=["A","BODY","LINK","IMG","IFRAME","BASE","FORM"],kn=["EMBED"],Rn=["href","src","background","action"],Nn=["
\ No newline at end of file
+var Sn=["javascript:","vbscript:"],Tn=["A","BODY","LINK","IMG","IFRAME","BASE","FORM"],kn=["EMBED"],Rn=["href","src","background","action"],Nn=["src"],Pn={BUTTON:{type:!0,form:!0},INPUT:{type:!0,form:!0,autocorrect:!0,list:!0},SELECT:{form:!0},OPTION:{form:!0},TEXTAREA:{form:!0},LABEL:{form:!0},FIELDSET:{form:!0},LEGEND:{form:!0},OBJECT:{form:!0}},Dn={colgroup:{depth:2,before:"<table><colgroup>",after:"</colgroup></table>"},table:{depth:1,before:"<table>",after:"</table>"},tbody:{depth:2,before:"<table><tbody>",after:"</tbody></table>"},tfoot:{depth:2,before:"<table><tfoot>",after:"</tfoot></table>"},thead:{depth:2,before:"<table><thead>",after:"</thead></table>"},tr:{depth:3,before:"<table><tbody><tr>",after:"</tr></tbody></table>"}},jn="http://www.w3.org/2000/svg",In="http://www.w3.org/2000/svg",Ln={foreignObject:1,desc:1,title:1},Mn=Object.create(null);
+["b","big","blockquote","body","br","center","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","head","hr","i","img","li","listing","main","meta","nobr","ol","p","pre","ruby","s","small","span","strong","strike","sub","sup","table","tt","u","ul","var"].forEach(function(e){return Mn[e]=1});

File sizes:

164729 guapic_ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js
589450 elixir_ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js
1 Like

Thanks :smiley: so what is the possible best solution for this? rebuilds are giving gateway errors.

You should start over from scratch and rebuild. Something is deeply wrong with your configuration.


Learned from a PM:

When targeting your (non-cloudflared) reverse proxy:

○ → curl -k https://forum.pivx.org/assets/ember_jquery-07f49b58317ea9292d939348ec0091eb50a9d8aaabd9e86cc074ef5f049918aa.js | wc -c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  8  575k    8 48746    0     0  73901      0  0:00:07 --:--:--  0:00:07 73857
curl: (56) GnuTLS recv error (-9): A TLS packet with unexpected length was received.

When targeting your actual server:

○ → curl -k | wc -c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  575k  100  575k    0     0  1016k      0 --:--:-- --:--:-- --:--:-- 1017k

Your reverse proxy is broken and you need to fix it. This is not a Discourse problem.


When pointing the cloudflare A record to the normal server IP it doesn’t connect to the site. Only over the reverse proxy. thanks for the assistance thus far.

I’m getting these same errors too, on a fresh install. I have cloudflare for my root domain, but it’s bypassing on the subdomain I’ve installed discourse to https://forum.theopen.institute. I followed the instructions here for running other sites on the same machine.

The strange thing is, each time, I am able to get most of the way through the welcome and installation process before I start getting the ERR_SPDY_PROTOCOL_ERROR responses in console.

t turns out that (in my case at least) the problem was indeed outside Discourse. I had a permissions problem in my /var/lib/nginx/fastcgi folder. chowning back over to my nginx got discourse working.

It sounds like OP’s issue was different, but since the symptoms and error messages were similar I thought I’d post an update for anyone coming through in the future.

My issue is solved, Turns out the reverse proxy was running out of disk space and thus couldn’t process the files.