Skip to content

Commit

Permalink
Add mimetypes to be gzipped based on CloudFlare
Browse files Browse the repository at this point in the history
  • Loading branch information
TrafeX committed Feb 23, 2024
1 parent cf05bd7 commit 93b0234
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,15 +29,16 @@ 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;

# 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";

Expand Down

0 comments on commit 93b0234

Please sign in to comment.