反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。! [7 U% C# O9 {! M# @6 @, p; E
& N0 z% M5 r$ m5 n3 _7 h% {9 g1 ]# ~一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
$ t0 E; E9 `0 Z3 K5 B F" y1 w0 v/ z) ]& J! }8 N
打开ngx_http_substitutions_filter_module的github看到:
9 P5 |. G9 {7 U% R" S0 y0 E: z( L( a- N% }% c% U5 K
subs_filter_types
; `9 o) N' _" m9 L6 X+ T- X syntax: *subs_filter_types mime-type [mime-types] *- @9 F; }0 ? Z8 O4 m& I! M# R3 \
5 u9 y v9 p P' o$ g* odefault: *subs_filter_types text/html*
O/ w( |. R* ^2 ?) F# Z5 M7 T9 j3 ?) Y2 X; D" U$ p
context: *http, server, location*
4 ^9 a, N0 R" m0 V9 E3 H' |; Z( Y- V$ W$ r% w2 s0 c$ J1 r; N+ ~
*subs_filter_types* is used to specify which content types should be9 t0 J) \8 b4 E% g6 |
checked for *subs_filter*. The default is only *text/html*.
1 H- [! _6 f/ O' U& a6 R- }+ U$ D! l5 C
This module just works with plain text. If the response is compressed,
5 j: U7 a. w4 S. w; w; ` it can’t uncompress the response and will ignore this response. This
( W: y$ C' L+ _! l! a; p: [- Y module can be compatible with gzip filter module. But it will not work
1 t! e/ f0 [0 E7 ?# a) j2 q with proxy compressed response. You can disable the compressed response6 H+ J# f y) v! ~. P& k
like this:/ z+ X2 E5 Q, M
2 M& s' B! ^* `- s( {
proxy_set_header Accept-Encoding “”;
: x" A6 j- r- e/ s" x7 p0 G
/ `* D2 |6 l6 y. Q好吧,原来是没指定替换类型,默认只替换html0 T5 l4 }8 Y2 T. t5 G8 ]
; [7 ]# F3 e' p" W在nginx站点配置中加入下面代码:
) @9 C% P, {5 \" m2 V% F3 e/ B. H
" X% ]* z3 s; K/ I' H! D, e+ e subs_filter_types text/css text/xml application/xhtml+xml application/xml;6 Y2 v: b4 g+ A1 \2 p b0 f6 q
& e& q7 B. }1 e& t 重启nginx就解决了# U. E, ~ d3 q1 s
|