this adds the following configuration on "pagespeed on"

gzip on;
gzip_proxied any;
gzip_vary on;
gzip_types application/ecmascript;
gzip_types application/javascript;
gzip_types application/json;
gzip_types application/pdf;
gzip_types application/postscript;
gzip_types application/x-javascript;
gzip_types image/svg+xml;
gzip_types text/css;
gzip_types text/csv;
gzip_types text/html;
gzip_types text/javascript;
gzip_types text/plain;
gzip_types text/xml;
gzip_http_version 1.0;

If any explicit gzip configuration is detected the gzip configuration
set by pagespeed is rolled back completely and the explicit gzip
configuration is used.

To enable/disable gzip with pagespeed the following commands can be used:

pagespeed gzip on;
pagespeed gzip off;
This commit is contained in:
Kees Spoelstra
2014-06-11 17:28:25 +02:00
parent 29a43196e8
commit ad1a1594d6
5 changed files with 125 additions and 98 deletions
+29 -1
View File
@@ -82,7 +82,6 @@ function keepalive_test() {
done
# Filter the curl output from unimportant messages
# 'Found bundle for host...' is emitted by newer versions of curl.
OUT=$(cat "$TEST_TMP/$CURL_LOG_FILE"\
| grep -v "^[<>]"\
| grep -v "^{ \\[data not shown"\
@@ -2698,6 +2697,35 @@ OUT=$($WGET_DUMP --header=Host:date.example.com \
check_from "$OUT" egrep -q '^Date: Fri, 16 Oct 2009 23:05:07 GMT'
WGET_ARGS=
#very basic tests to test gzip nesting configuration
start_test Nested gzip gzip off
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/"
HEADERS="--header=Accept-Encoding:gzip --header=Host:gzip-test1.example.com"
OUT=$($WGET_DUMP -O /dev/null -S $HEADERS $URL 2>&1)
check_not_from "$OUT" fgrep -qi 'Content-Encoding: gzip'
check_not_from "$OUT" fgrep -qi 'Vary: Accept-Encoding'
start_test Nested gzip gzip on
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/styles/big.css"
HEADERS="--header=Accept-Encoding:gzip --header=Host:gzip-test1.example.com"
OUT=$($WGET_DUMP -O /dev/null -S $HEADERS $URL 2>&1)
check_from "$OUT" fgrep -qi 'Content-Encoding: gzip'
check_from "$OUT" fgrep -qi 'Vary: Accept-Encoding'
start_test Nested gzip pagespeed off
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/"
HEADERS="--header=Accept-Encoding:gzip --header=Host:gzip-test2.example.com"
OUT=$($WGET_DUMP -O /dev/null -S $HEADERS $URL 2>&1)
check_not_from "$OUT" fgrep -qi 'Content-Encoding: gzip'
check_not_from "$OUT" fgrep -qi 'Vary: Accept-Encoding'
start_test Nested gzip pagespeed on
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/styles/big.css"
HEADERS="--header=Accept-Encoding:gzip --header=Host:gzip-test2.example.com"
OUT=$($WGET_DUMP -O /dev/null -S $HEADERS $URL 2>&1)
check_from "$OUT" fgrep -qi 'Content-Encoding: gzip'
check_from "$OUT" fgrep -qi 'Vary: Accept-Encoding'
if [ "$NATIVE_FETCHER" != "on" ]; then
start_test Test that we can rewrite an HTTPS resource.
fetch_until $TEST_ROOT/https_fetch/https_fetch.html \
+29
View File
@@ -952,10 +952,39 @@ http {
server {
listen @@SECONDARY_PORT@@;
server_name compressed-css.example.com;
pagespeed on;
pagespeed FileCachePath "@@FILE_CACHE@@";
pagespeed InPlaceResourceOptimization on;
}
# nested gzip config: pagespeed gzip on/off
server {
pagespeed on;
listen @@SECONDARY_PORT@@;
server_name gzip-test1.example.com;
pagespeed FileCachePath "@@FILE_CACHE@@";
location /mod_pagespeed_example/ {
pagespeed gzip off;
}
location /mod_pagespeed_example/styles/ {
pagespeed gzip on;
}
}
# nested gzip config: pagespeed on/off
server {
pagespeed on;
listen @@SECONDARY_PORT@@;
server_name gzip-test2.example.com;
pagespeed FileCachePath "@@FILE_CACHE@@";
location /mod_pagespeed_example/ {
pagespeed off;
}
location /mod_pagespeed_example/styles/ {
pagespeed on;
}
}
server {
listen @@PRIMARY_PORT@@;
server_name localhost;