Rocketchat extremely slow when running through Nginx/Caddy

Description

Hello, it appears that when I run rocketchat through a reverse proxy (to enable SSL), the website loads extremely slowly. Please compare:

https://study.gjk.cat
http://study.magnusi.tech:3000

Regular HTTP & No Proxy is quite fast. I don’t know what’s causing it, please advise. I tried both nginx and caddy, currently using caddy with this config:

*:80 {
	gzip
	root /usr/share/caddy
}

study.gjk.cat {
	proxy / 127.0.0.1:3000 {
		header_upstream X-Forwarded-Proto {scheme}
		header_upstream X-Forwarded-For {host}
		header_upstream Host {host}
		websocket
	}
}


import conf.d/*.conf

And RocketChat is running with these variables:

DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
EDITOR=nano
HOME=/root
LANG=en_US.UTF-8
LOGNAME=root
MAIL=/var/spool/mail/root
MONGO_OPLOG_URL=mongodb://localhost:27017/local?replSet=rs01
MONGO_URL=mongodb://localhost:27017/rocketchat
PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PWD=/usr/share/rocketchat-server
SHELL=/usr/bin/fish
SHLVL=1
STARSHIP_SHELL=fish
TERM=xterm-256color
XDG_RUNTIME_DIR=/run/user/0
XDG_SESSION_CLASS=user
XDG_SESSION_ID=22
XDG_SESSION_TYPE=tty
ROOT_URL=https://style.gjk.cat
NODE_ENV=production
PORT=3000

Server Setup Information

  • Version of Rocket.Chat Server: 3.0.4
  • Operating System: Arch Linux
  • Deployment Method: AUR Package
  • Number of Running Instances: 1
  • DB Replicaset Oplog: enabled per tutorial
  • NodeJS Version: 12.16.1
  • MongoDB Version: 4.2.3
  • Proxy: nginx/caddy
  • Firewalls involved: none

I resolved the issue. Apparently, nginx didn’t actually stop when stopping the service, so Caddy wouldn’t launch and nginx would still be extremely slow.

Issue was resolved by killing nginx, reconfiguring caddy and using caddy