diff --git a/config b/config index 1c81a5991..31a3e4c9c 100644 --- a/config +++ b/config @@ -27,8 +27,8 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then echo " You need to separately download the pagespeed library:" echo "" echo " $ cd /path/to/ngx_pagespeed" - echo " $ wget https://dl.google.com/dl/page-speed/psol/1.8.31.2.tar.gz" - echo " $ tar -xzvf 1.8.31.2.tar.gz # expands to psol/" + echo " $ wget https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz" + echo " $ tar -xzvf 1.8.31.4.tar.gz # expands to psol/" echo "" echo " Or see the installation instructions:" echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build" @@ -205,7 +205,7 @@ if [ $ngx_found = yes ]; then else cat << END $0: error: module ngx_pagespeed requires the pagespeed optimization library. -Look in obj/autoconf.err for more details. +Look in objs/autoconf.err for more details. END exit 1 fi diff --git a/src/ngx_pagespeed.cc b/src/ngx_pagespeed.cc index 66f5c8c48..b354b86d8 100644 --- a/src/ngx_pagespeed.cc +++ b/src/ngx_pagespeed.cc @@ -286,11 +286,6 @@ void copy_response_headers_from_ngx(const ngx_http_request_t* r, headers->set_status_code(r->headers_out.status); - if (r->headers_out.location != NULL) { - headers->Add(HttpAttributes::kLocation, - str_to_string_piece(r->headers_out.location->value)); - } - // Manually copy over the content type because it's not included in // request_->headers_out.headers. headers->Add(HttpAttributes::kContentType, @@ -1178,6 +1173,12 @@ ngx_int_t ps_base_fetch_handler(ngx_http_request_t* r) { STR_CASE_EQ_LITERAL(header->key, "Last-Modified") || STR_CASE_EQ_LITERAL(header->key, "Expires"))))) { header->hash = 0; + if (STR_CASE_EQ_LITERAL(header->key, "Location")) { + // There's a possible issue with the location header, where setting + // the hash to 0 is not enough. See: + // https://github.com/nginx/nginx/blob/master/src/http/ngx_http_header_filter_module.c#L314 + r->headers_out.location = NULL; + } } } } else { diff --git a/src/ngx_rewrite_options.cc b/src/ngx_rewrite_options.cc index 93e11733a..e2d240de8 100644 --- a/src/ngx_rewrite_options.cc +++ b/src/ngx_rewrite_options.cc @@ -498,6 +498,10 @@ NgxRewriteOptions* NgxRewriteOptions::Clone() const { return options; } +void NgxRewriteOptions::Merge(const RewriteOptions& src) { + SystemRewriteOptions::Merge(src); +} + const NgxRewriteOptions* NgxRewriteOptions::DynamicCast( const RewriteOptions* instance) { return dynamic_cast(instance); diff --git a/src/ngx_rewrite_options.h b/src/ngx_rewrite_options.h index a32b93296..0c04dcb64 100644 --- a/src/ngx_rewrite_options.h +++ b/src/ngx_rewrite_options.h @@ -140,6 +140,7 @@ class NgxRewriteOptions : public SystemRewriteOptions { // Make an identical copy of these options and return it. virtual NgxRewriteOptions* Clone() const; + virtual void Merge(const RewriteOptions& src); // Returns a suitably down cast version of 'instance' if it is an instance // of this class, NULL if not.