Discourse not using brotli or gzip compression?

Hi. I installed Discourse on a CentOS server. I also use Centos web panel.

It appears that the files aren’t compressed on Discourse though it is supposed to use brotli by default and fallback to gzip.

Example for this file which is 2.2 MB:
https://forum.canapin.win/assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js

Response Headers:
    accept-ranges: bytes
    cache-control: max-age=31536000
    cache-control: public,immutable
    content-length: 2334732
    content-type: application/javascript
    date: Sat, 12 Oct 2019 23:36:50 GMT
    expires: Sun, 11 Oct 2020 23:36:50 GMT
    last-modified: Sat, 12 Oct 2019 23:33:24 GMT
    server: nginx/1.16.1
    status: 200
Request Headers:
    :authority: forum.canapin.win
    :method: GET
    :path: /assets/application-301651b1c7400a000974a9cecafd44ad3304cf647cf17bcfa7af68e9ed1ac4b7.js
    :scheme: https
    accept: */*
    accept-encoding: gzip, deflate, br
    accept-language: en-US,en;q=0.9
    cache-control: no-cache
    cookie: _t=89fc0a58f2a08712f3156f2687553cf8; __profilin=p%3Dt%2Ca%3Da546654bdc3538a213cd6c6fcc4c2a92; _forum_session=YnhETkNaTjF1YTEzVXUvZW1pS1NuTVVzdm1WWndlRktMdmNlU3hBalR3dUYwRGVUTzhBSlM5WkNiS0hDdVQvRmtGeGtLOTRRNndRWk9YUFczbTJHdjMyajlNNkpXZ2xzeEZwMkVmd2grcHlILzJVVmZWeFVVNlBERVF4S3VDMkJ0N2pUWktJWitmbXc2MDFFV1VEcG56M09jalRjMEJOb2t6M1NSbjJQUit1eDFRZkdCMGplVjhLK1JUNFVNdnRmVmZuK1B1NVdwK0N5Q1VrNTdDa01tdXh1T3h2aDY4OGx0SDMzRC9Ma0YzdElFS0p6b0x3algvVnRhVlljVDQyOS0tYnpSeFl5MjNoMVFVMm42UE0ybFJ6Zz09--b49c4c072e917618f874818e246298bce81235e5
    dnt: 1
    pragma: no-cache
    referer: https://forum.canapin.win/
    sec-fetch-mode: no-cors
    sec-fetch-site: same-origin
    user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36

Any idea why?

1 Like

Is your install a standard one following our official install guide w/docker?

2 Likes

I followed this :
https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
And I just changed the ports in app.yml before bootstrapping the app since the port 80 was already used.

I didnt use discourse setup, I already had docker installed.

1 Like

To be very precise about how I installed Discourse, here are the steps I followed:

git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
cp samples/standalone.yml containers/app.yml

Changed my ports here:

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "8080:80" # fwd host port 80 to container port 8080 (http)
  - "4443:443" # fwd host port 443 to container port 4443 (https)
./launcher bootstrap app
./launcher start app

And redirected my port in my nginx configuration in centos web panel:

That’s all.

Well there is your problem, it is proxying stuff and not passing stuff through properly.

I would recommend just keeping to our standard install which directly connects the internet to our container and handles all this stuff for you.

4 Likes

Thank you. I don’t know much about servers and stuff like this and I don’t know how I can achieve that. I previously used Plesk with its default settings and it was working perfectly even with nginx proxying.

I’ll try to figure this out anayway I guess.

Thanks to @Arkshine my issue was fixed.

I had to comment theses lines in /etc/nginx/proxy.inc:

proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';

The server now sends the files properly compressed by Discourse:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.