Skip to content

Instantly share code, notes, and snippets.

@cindreta
Created September 5, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cindreta/57db9a11ef0ad88f96ba2da59f64bb7e to your computer and use it in GitHub Desktop.
Save cindreta/57db9a11ef0ad88f96ba2da59f64bb7e to your computer and use it in GitHub Desktop.
Enable GZIP Encoding for all application/json responses
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/javascript" \
"application/json" \
"application/ld+json" \
"application/manifest+json" \
"application/schema+json" \
"application/geo+json" \
"application/x-javascript" \
</IfModule>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment