From 93b0234d4f8665347f531c634d1d82ec5303da3a Mon Sep 17 00:00:00 2001 From: Tim de Pater Date: Fri, 23 Feb 2024 14:36:46 +0100 Subject: [PATCH] Add mimetypes to be gzipped based on CloudFlare --- config/nginx.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/nginx.conf b/config/nginx.conf index ba8d09a93..206334e31 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -8,6 +8,7 @@ events { http { include mime.types; + # Threat files with a unknown filetype as binary default_type application/octet-stream; # Define custom log format to include reponse times @@ -28,7 +29,7 @@ http { uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; - # Hardening + # Hide headers that identify the server to prevent information leakage proxy_hide_header X-Powered-By; fastcgi_hide_header X-Powered-By; server_tokens off; @@ -36,7 +37,8 @@ http { # Enable gzip compression by default gzip on; gzip_proxied any; - gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss; + # Based on CloudFlare's recommended settings + gzip_types text/richtext text/plain text/css text/x-script text/x-component text/x-java-source text/x-markdown application/javascript application/x-javascript text/javascript text/js image/x-icon image/vnd.microsoft.icon application/x-perl application/x-httpd-cgi text/xml application/xml application/rss+xml application/vnd.api+json application/x-protobuf application/json multipart/bag multipart/mixed application/xhtml+xml font/ttf font/otf font/x-woff image/svg+xml application/vnd.ms-fontobject application/ttf application/x-ttf application/otf application/x-otf application/truetype application/opentype application/x-opentype application/font-woff application/eot application/font application/font-sfnt application/wasm application/javascript-binast application/manifest+json application/ld+json application/graphql+json application/geo+json; gzip_vary on; gzip_disable "msie6";