From 36f3e3fe504e1d3c7c44ff161ef32483683c7e0b Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 20 Feb 2019 15:12:04 -0800 Subject: [PATCH] Enable gzip compression for large objects This doesn't trigger a re-configure (since it's not a big deal) --- CHANGES | 1 + src/appconfig.ejs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index 2e45ae5bd..9896d85f2 100644 --- a/CHANGES +++ b/CHANGES @@ -1540,4 +1540,5 @@ [3.6.0] * Make reboot required check server side * Update node to 10.15.1 +* Enable gzip compression for large objects diff --git a/src/appconfig.ejs b/src/appconfig.ejs index d789e43be..33e37dbeb 100644 --- a/src/appconfig.ejs +++ b/src/appconfig.ejs @@ -90,6 +90,14 @@ server { add_header Referrer-Policy "no-referrer-when-downgrade"; proxy_hide_header Referrer-Policy; + # gzip responses that are > 50k and not images + gzip on; + gzip_min_length 50k; + gzip_types text/css text/javascript text/xml text/plain application/javascript application/x-javascript application/json; + + # enable for proxied requests as well + gzip_proxied any; + <% if ( endpoint === 'admin' ) { -%> # CSP headers for the admin/dashboard resources add_header Content-Security-Policy "default-src 'none'; connect-src wss: https: 'self' *.cloudron.io; script-src https: 'self' 'unsafe-inline' 'unsafe-eval'; img-src * data:; style-src https: 'unsafe-inline'; object-src 'none'; font-src https: 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self';";