Skip to content

Commit c782d7e

Browse files
committed
Add more mime types to be gzipped based on CloudFlare, hide powered-by headers
1 parent 804d2d4 commit c782d7e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/nginx.conf

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ events {
77

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

1213
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
@@ -19,14 +20,18 @@ http {
1920

2021
keepalive_timeout 65;
2122

23+
# Hide headers that identify the server to prevent information leakage
24+
proxy_hide_header X-Powered-By;
25+
fastcgi_hide_header X-Powered-By;
2226
server_tokens off;
2327

2428
# Enable gzip compression
2529
gzip on;
2630
gzip_disable "msie6";
2731
gzip_proxied any;
28-
29-
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
32+
# Based on CloudFlare's recommended settings
33+
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;
34+
gzip_vary on;
3035

3136
# Forward the cloudfront scheme from upstream
3237
map "$http_cloudfront_forwarded_proto$http_x_forwarded_proto" $forwarded_scheme {

0 commit comments

Comments
 (0)