Skip to content

Commit

Permalink
Fix to allow you to enable content-encoding: identity. Set to ‘none’ …
Browse files Browse the repository at this point in the history
…by default. #548
  • Loading branch information
rhukster committed Jan 18, 2017
1 parent e2ee02a commit 61c0c31
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions system/blueprints/config/system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions system/config/system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion system/src/Grav/Common/Grav.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,12 @@ public function shutdown()
} 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');
}

}


Expand Down

0 comments on commit 61c0c31

Please sign in to comment.