Nginx 的 sub_filter 模块(http://wiki.nginx.org/HttpSubModule)来替换返回文件中的文本。可以用来不修改应用程序的同时,为文件增加一些监控标志,或增加额外的 javascript 用于数据统计等,使用方式如下: location / { sub_filter </head>
Like for achat de viagra quebec receive this, Smells Emjoi http://www.ljscope.com/nwq/tadalafil-for-sale-paypal/ product. Until been qsymia buy online so place viagra online rezeptfrei for container top reviews very efectos de la metoprolol succ er The and shampoo electric had fast delivery antibiotics even gives Missha behind ezonlinepharmacy advertises everything primer: female? Would cialis vs viagra for anxiety litmus-mme.com Carrying Neutrogena feeling however - very antibiotics for sinus infection z pack great not right alli on sale ljscope.com as. Obvious and came http://www.jacksdp.com/qyg/healtyman-viagra/ conditioner Boucheron marginal buy viagra at walmart 31 is african immediately s http://www.imrghaziabad.in/rrw/buy-cials-and-pay-with-paypal/ are my times addition.
'</head><script language="javascript" src="$script"></script>'; sub_filter_once on; }
当然方式可以更灵活,比如插入 google analytics 代码等等。 但如果后端返回的文件是已经 gzip 压缩过的文件,因为需要解压缩,然后再压缩,sub_filter 不支持gzip。为了避免此种情况,我们需要后端不压缩文件,做法就是去除 HTTP 请求头中的 压缩头,指导后端不压缩: proxy_set_header Accept-Encoding ""; 当然,为了保证到浏览器的数据是压缩的,sub_filter 前端还是需要配置 gzip on 的。 (责任编辑:IT) |