PageSpeed禁止.js重写Nginx

时间:2019-06-01 14:43:31

标签: apache nginx pagespeed mod-pagespeed

https://www.modpagespeed.com/doc/restricting_urls上的官方文档提供了示例:

DELIMITER $$
CREATE PROCEDURE `DeleteTeam`(IN `pTeamID` INT(11))
BEGIN
    Declare vCount int;
    DECLARE CONTINUE HANDLER FOR 1451
    BEGIN
        RESIGNAL SET
        MESSAGE_TEXT = 'Students are in team';
    END;

    Select count(*) Into vCount From TeamAllocation
    INNER Join Team on Team.TeamID = TeamAllocation.TeamID
    WHERE Team.TeamID = pTeamID;

    If vCount < 1 THEN  #If no members in team
    DELETE From Team
    WHERE Team.TeamID = pTeamID;
    else 
    select ('Cannot delete a team which have registered students');
    End If;
END$$
DELIMITER ;

我们在路径Example 1: Excluding JavaScript files that cannot be rewritten Some JavaScript files are sensitive to their own names as they traverse the DOM. Therefore any rewriting on these files is invalid. We cannot cache-extend them or minifiy them. When such files are identified, we can exclude from the rewriting process via: Nginx: pagespeed Disallow "*/jquery-ui-1.8.2.custom.min.js"; pagespeed Disallow "*/js_tinyMCE.js"; 上获得了本地analytics.js文件

我们的配置:

https://www.example.com/sites/default/files/googleanalytics/analytics.js

(尝试了多种变化)

重新注视/重新加载Nginx无法解决,它仍然重写文件(输出为 #javascript pagespeed EnableFilters rewrite_javascript; pagespeed EnableFilters inline_javascript; pagespeed EnableFilters combine_javascript; pagespeed Disallow "*/analytics.js"; pagespeed Disallow "*analytics.js"; pagespeed Disallow "https://www.example.com/sites/default/files/googleanalytics/analytics.js";

完整配置

analytics.js,qpsfc22.pagespeed.jm.vld5clu5x_.js

0 个答案:

没有答案