Several rewrite driver factory options are duplicated between apache and nginx. Instead of duplicating this one too, a PSOL change moves them into system/, and this change takes advantage of that move.
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;
We test the nesting of the gzip configuration (pagespeed gzip on/off and
pagespeed on/off)
Ideally we need to test all the content types as well and the rollback in
case of an explicit gzip configuration, but to do this we need to be able
to map a custom directory into the nginx tests this and seperate nginx
config files.
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/238
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;
PSOL change for in_place_rewrite_context.cc
- Reorder setting the status code so we actually change the
ResponseHeaders that we are using to serve
- Prevent non-error http status codes from being served up.
As noted by @jeffkaufman, to prevent a potential lifetime issue with
ResponseHeaders, remove the call to ps_release_base_fetch() in
ps_decline_request().
PSOL patch:
```diff
--- ../rewriter/in_place_rewrite_context.cc (revision 4020)
+++ ../rewriter/in_place_rewrite_context.cc (working copy)
@@ -127,9 +127,20 @@
// to us.
streaming_ = false;
set_request_headers(NULL);
+ // If we cannot rewrite in-place, we should not serve a 200/OK.
+ // Serve kNotFound instead to fall back to the server's native
+ // method of serving the url and indicate we don't want it recorded
+ // either.
+ // TODO(oschaaf): When the resource is loaded via LoadFromFile,
+ // this code gets repeatedly hit for the same url. That might
+ // become a drag when the file in question is very large and popular.
+ // Marking urls that end up in this flow as not cachable in the http cache
+ // at this point had no effect (for the LoadFromFile flow at least).
+ if (!response_headers()->IsErrorStatus()) {
+ response_headers()->set_status_code(HttpStatus::kNotFound);
+ }
set_response_headers(NULL);
set_extra_response_headers(NULL);
- response_headers()->set_status_code(HttpStatus::kNotFound);
SharedAsyncFetch::HandleDone(false);
}
}
```
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 an explicit configuration is detected the gzip configuration
set by pagespeed on is rollbacked
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/238