Skip to content

Commit 93b0234

Browse files
committed
Add mimetypes to be gzipped based on CloudFlare
1 parent cf05bd7 commit 93b0234

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config/nginx.conf

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ events {
88

99
http {
1010
include mime.types;
11+
# Threat files with a unknown filetype as binary
1112
default_type application/octet-stream;
1213

1314
# Define custom log format to include reponse times
@@ -28,15 +29,16 @@ http {
2829
uwsgi_temp_path /tmp/uwsgi_temp;
2930
scgi_temp_path /tmp/scgi_temp;
3031

31-
# Hardening
32+
# Hide headers that identify the server to prevent information leakage
3233
proxy_hide_header X-Powered-By;
3334
fastcgi_hide_header X-Powered-By;
3435
server_tokens off;
3536

3637
# Enable gzip compression by default
3738
gzip on;
3839
gzip_proxied any;
39-
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
40+
# Based on CloudFlare's recommended settings
41+
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;
4042
gzip_vary on;
4143
gzip_disable "msie6";
4244

0 commit comments

Comments
 (0)