src/ngx_pagespeed.cc
// Clear a few headers from html responses.
Clear a few headers from html responses.
Clear a few headers from html responses .
ngx_int_t ps_html_rewrite_fix_headers_filter(ngx_http_request_t* r) {
  ps_request_ctx_t* ctx = ps_get_request_context(r);
  if (r != r->main || ctx == NULL || !ctx->html_rewrite ||
      ctx->preserve_caching_headers == kPreserveAllCachingHeaders) {
    return ngx_http_next_header_filter(r);
  }
  if (ctx->preserve_caching_headers == kDontPreserveHeaders) {
    NgxCachingHeaders caching_headers(r);
    ps_set_cache_control(r, string_piece_to_pool_string(
        r->pool, caching_headers.GenerateDisabledCacheControl()));
  }
  ngx_http_clear_etag(r);
  ngx_http_clear_last_modified(r);
  if (r->headers_out.expires) {
    r->headers_out.expires->hash = 0;
    r->headers_out.expires = NULL;
  }
  return ngx_http_next_header_filter(r);
}
ngx_int_t ps_html_rewrite_fix_headers_filter ( ngx_http_request_t * r ) { ps_request_ctx_t * ctx = ps_get_request_context ( r ) ; if ( r != r -> main || ctx == NULL || ! ctx -> html_rewrite || ctx -> preserve_caching_headers == kPreserveAllCachingHeaders ) { return ngx_http_next_header_filter ( r ) ; } if ( ctx -> preserve_caching_headers == kDontPreserveHeaders ) { NgxCachingHeaders caching_headers ( r ) ; ps_set_cache_control ( r , string_piece_to_pool_string ( r -> pool , caching_headers . GenerateDisabledCacheControl ( ) ) ) ; } ngx_http_clear_etag ( r ) ; ngx_http_clear_last_modified ( r ) ; if ( r -> headers_out . expires ) { r -> headers_out . expires -> hash = 0 ; r -> headers_out . expires = NULL ; } return ngx_http_next_header_filter ( r ) ; }
Clear a few headers from html responses.
Clear a few headers from html responses .
// Don't cache html.  See mod_instaweb:instaweb_fix_headers_filter. // Pagespeed html doesn't need etags: it should never be cached. // An html page may change without the underlying file changing, because of // how resources are included.  Pagespeed adds cache control headers for // resources instead of using the last modified header. // Clear expires