Fix to allow you to enable content-encoding: identity. Set to ‘none’ by default. #548

This commit is contained in:
Andy Miller
2017-01-18 15:02:53 -07:00
parent e2ee02a71d
commit 61c0c31992
4 changed files with 19 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
1. [](#bugfix)
* Fixed `page.collection()` returning array and not Collection object when header variable did not exist
* Revert `Content-Encoding: identity` fix, and let you set `cache: allow_webserver_gzip:` option to switch to `identity` [#548](https://github.com/getgrav/grav/issues/548)
# v1.1.13
## 01/17/2017

View File

@@ -575,6 +575,17 @@ form:
validate:
type: bool
cache.allow_webserver_gzip:
type: toggle
label: PLUGIN_ADMIN.ALLOW_WEBSERVER_GZIP
help: PLUGIN_ADMIN.ALLOW_WEBSERVER_GZIP_HELP
highlight: 0
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
twig:
type: section
title: PLUGIN_ADMIN.TWIG_TEMPLATING

View File

@@ -73,6 +73,7 @@ cache:
prefix: 'g' # Cache prefix string (prevents cache conflicts)
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
gzip: false # GZip compress the page output
allow_webserver_gzip: false # If true, `content-encoding: identity` but connection isn't closed before `onShutDown()` event
redis:
socket: false # Path to redis unix socket (e.g. /var/run/redis/redis.sock), false = use server and port to connect

View File

@@ -306,7 +306,12 @@ class Grav extends Container
} else {
// Without gzip we have no other choice than to prevent server from compressing the output.
// This action turns off mod_deflate which would prevent us from closing the connection.
header('Content-Encoding: identity');
if ($this['config']->get('system.cache.allow_webserver_gzip')) {
header('Content-Encoding: identity');
} else {
header('Content-Encoding: none');
}
}