美文网首页
nginx给拦截的js注入加时间年月

nginx给拦截的js注入加时间年月

作者: 吉凶以情迁 | 来源:发表于2025-03-07 11:49 被阅读0次

注入到对应的head插入js脚本和css 的玩法相比大家应该都知道,这里就不提了,为了让它不随便缓存给它过滤下时间为年月 默认$time_iso8601是完整时间

map $time_iso8601 $year_month {
    "~^(?<year>\d{4})-(?<month>\d{2})" "$year$month";
}

sub_filter '</head>' ' <link rel="stylesheet" href="xcss/style.css"><script src="script.js?time=$year_month"></script> </head>';

相关文章

网友评论

      本文标题:nginx给拦截的js注入加时间年月

      本文链接:https://www.haomeiwen.com/subject/baudmjtx.html