incubator-pagespeed-mod icon indicating copy to clipboard operation
incubator-pagespeed-mod copied to clipboard

Headers not respecting ModPagespeedDisallow for page scripts

Open rafaelpatro opened this issue 5 years ago • 4 comments

Hi guys I'm trying to disable mod_pagespeed for some pages and it works. Nothing optimized when applying ModPagespeedDisallow.

But pagespeed headers keep affecting JS files.

ModPagespeedDisallow "*/checkout/*"
ModPagespeedRewriteLevel OptimizeForBandwidth
ModPagespeedDisableRewriteOnNoTransform off
ModPagespeedEnableFilters inline_css,move_css_to_head,inline_preview_images,lazyload_images,defer_javascript,canonicalize_javascript_libraries,insert_dns_prefetch,extend_cache,combine_javascript,convert_meta_tags,inline_google_font_css

Header always set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" #not working

So I'm trying to set cache-control directive for JS files and has no effect. But when I disable pagespeed completely my cache-control headers works.

ModPagespeedDisallow "*/checkout/*"
ModPagespeedRewriteLevel OptimizeForBandwidth
ModPagespeedDisableRewriteOnNoTransform off
ModPagespeedEnableFilters inline_css,move_css_to_head,inline_preview_images,lazyload_images,defer_javascript,canonicalize_javascript_libraries,insert_dns_prefetch,extend_cache,combine_javascript,convert_meta_tags,inline_google_font_css
ModPagespeed Off

Header always set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" #working

rafaelpatro avatar Jul 04 '19 02:07 rafaelpatro

Could you try https://www.modpagespeed.com/doc/configuration#add-resource-header ? (Not 100% sure that works for non-.pagespeed. resources, but it might)

oschaaf avatar Jul 04 '19 07:07 oschaaf

Thanks @oschaaf But did not work.

ModPagespeedAddResourceHeader "Cache-Control" "max-age=0, no-cache, no-store, must-revalidate"
ModPagespeedAddResourceHeader "Expires" "Wed, 12 Jan 1980 05:00:00 GMT"
AH00526: Syntax error on line...
Rejecting header 'Cache-Control '
Rejecting header 'Expires '

rafaelpatro avatar Jul 04 '19 13:07 rafaelpatro

Hi @rafaelpatro Maybe the headers are changed by the IPRO that is enabled by default in latest versions of pagespeed. Can you try to disable it? ModPagespeedInPlaceResourceOptimization off This disables the optimization of resources that are not in the html, like images loaded by a javascript snippet.

Lofesa avatar Jul 05 '19 01:07 Lofesa

A similar issue.

I am unable to get ModPagespeedDisallow to work for .mp4 files. IPRO applies a s-maxage=10 to unoptimised resources, we pre-optimise .mp4 so just wish to deliever the content. Disabling pagespeed for a directory or just mp4 does not seem to ignore.

Debaucus avatar Feb 03 '20 22:02 Debaucus