I have a small issue with rewrite_javascript
module which minify JS file. This function is awesome since pagespeed also generate a new URL for everyfile if we purge the cache, thus enable us to use Cloudfront cache easily with pagespeed's ShardDomain
However I encounter an issue with one of my file /js/min/app/common.js"
which doesn't get rewrite at all despite the file under it has been rewrite.
I just don't get the idea why this could be happening.
Are there anyone have the same issue and found a solution?
Thank you
UPDATE:
Sorry for the time it takes for this question. I post here the details of my pagespeed configuration:
In HTTP block, I have:
pagespeed InPlaceResourceOptimization on;
pagespeed PreserveUrlRelativity on;
pagespeed ForceCaching on;
pagespeed InPlaceRewriteDeadlineMs 100;
pagespeed EnableFilters collapse_whitespace;
pagespeed EnableFilters recompress_images;
pagespeed EnableFilters convert_meta_tags;
pagespeed EnableFilters prioritize_critical_css;
pagespeed EnableFilters extend_cache;
pagespeed EnableFilters rewrite_css,sprite_images;
pagespeed EnableFilters rewrite_javascript;
pagespeed EnableFilters extend_cache;
pagespeed GlobalStatisticsPath /pagespeed_global_statistics;
pagespeed GlobalAdminPath /pagespeed;
pagespeed EnableCachePurge on;
By default, Pagespeed will not rewrite JavaScript files that are considered "introspective". If you read the Pagespeed docs it states:
...a JavaScript file that calls document.getElementsByTagName('script') will not be rewritten
Looking into your common.js file, there are lines which include the function call document.getElementsByTagName('script')
. This is why Pagespeed will not rewrite the file.
If you want to disable this Pagespeed check, in your nginx config, add this line:
pagespeed AvoidRenamingIntrospectiveJavascript off;
More info in the Pagespeed docs.