nginx 反代能不能在 head 里插入一段 js

2015-05-26 13:57:45 +08:00
 holinhot

header_string 好像插入的是最前面 都在html外了
怎么能插入<head></head>之间

5168 次点击
所在节点    NGINX
11 条回复
server
2015-05-26 14:00:25 +08:00
记得伟大的Apache是可以,nginx没耍过。
101
2015-05-26 14:02:13 +08:00
可以,不过默认的功能不强,有第三方模块,搜索一下就能搞定
holinhot
2015-05-26 14:03:59 +08:00
@server
@101
把</head>替换成
xxxxxxxxxxxxxxxxxxxx</head>可行吗
fising
2015-05-26 14:05:54 +08:00
当然可以。
101
2015-05-26 14:06:49 +08:00
可以啊 关键字 subs_filter
falcon05
2015-05-26 14:07:18 +08:00
nginx有替代模块
rming
2015-05-26 14:14:39 +08:00
phithon
2015-05-26 14:56:15 +08:00
sub_filter </head> "<script>xxx</script></head>"
phithon
2015-05-26 14:57:53 +08:00
不过要先把gzip关掉
proxy_set_header Accept-Encoding "";
sub_filter </head> "<script>xxx</script></head>"
dallaslu
2015-05-26 22:58:44 +08:00
可以 +1
sky170
2015-08-19 08:37:01 +08:00
可以,但是有些会乱

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/193804

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX