- What version of Ghost are you using? 3.1.4
- What configuration? Digital Ocean 1Click Installer
- What browser? any
Hi all,
I have embedded a Unity WebGL build into a custom page template on my website. This works as intended. However the load time is a little slow because the files being served are gzipped despite the server not sending this header information. You can see the recommendations from the Unity documentation here.
I’ve attempted to add the following behind my well-known
location block in /etc/nginx/sites-enabled/my.domain.conf
and restarting nginx but it seems to have no effect.
location ~ .+\.unityweb$ {
add_header Content-Encoding gzip;
}
The result is:
server {
listen 80;
listen [::]:80;
server_name my.domain;
root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
location ~ /.well-known {
allow all;
}
location ~ .+\.unityweb$ {
add_header Content-Encoding gzip;
}
client_max_body_size 50m;
}
Is there anything else I need to do specifically for Ghost CMS to make this change work? I’m also not overly familiar with nginx so is this location correct? I have been using this forum thread to get the Content Encoding syntax.