Large Javascript file under assets folder

One of the file /assets/application-7c87db9088046beb643be94b61428105469e084e8d02f141c57adfaf14168c63.js is almost 3.1 MB in size and causing lots of warning in error.log for Nginx reverse proxy.

an upstream response is buffered to a temporary file /var/lib/nginx/proxy/2/77/0012036772 while reading upstream, client: XXXXXX

  • Does anybody know for what this much big javascript file is used for
  • Is there a way to reduce size of this file. One way to reduce warning in Nginx will be to increase buffer size to 3.1 MB, but isn’t that little too much from default nginx configuration
1 Like

When you first load a Discourse site, the full JavaScript application is sent to the browser (it’s then cached so subsequent page loads are much faster). That’s what that 3MB file is.

3 Likes

Also worth keeping in mind that by following the official install guide you get a pre-configured nginx reverse-proxy that serves this file using brotli compression that reduces it to 400kb.

4 Likes

Thanks @Falco. Using separate web and data container and manual reverse proxy configuration. Looks like guide at discourse/INSTALL-cloud.md at main · discourse/discourse · GitHub is for standalone container.

For pre-configured nginx reverse proxy configuration, do you mean using configuration from discourse/nginx.sample.conf at main · discourse/discourse · GitHub

That config file is the template we use in the official install guide, but it’s heavily modified by the install script during installation too.

I’m afraid we only provide the config file when running following our official install guide. If you deviate from it you will have to be careful to not lose everything we support like brotli, HTTP/2, IPv6, etc.

@Falco By reading discourse forum, can feel separate web and db container is preferred or may be recommended way. It will be great if there is an official guide on manual nginx configuration or automatic setup for separate containers.

Our preferred way to install is the one we documented as our official install guide. That said, using a separate web/data container doesn’t affect the pre-configured nginx inside the web container, it should work the same way, without a need for an extra reverse-proxy.

Looking for optimization while hosting multiple discourse forum using: Nginx proxy → Separate Web and DB container. In this scenario I assume performance enhancement done by official install has to be done manually in nginx proxy.

1 Like