incubator-pagespeed-mod
incubator-pagespeed-mod copied to clipboard
Headers not respecting ModPagespeedDisallow for page scripts
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
Could you try https://www.modpagespeed.com/doc/configuration#add-resource-header ? (Not 100% sure that works for non-.pagespeed. resources, but it might)
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 '
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.
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.