反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
$ D- o3 o! e3 Q& d0 N
9 {" \9 S: T7 @) u, U) k一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….) ?1 Q9 I8 X: d- j" a
/ U" j, q% {7 j& O' M \; M- U打开ngx_http_substitutions_filter_module的github看到:* e7 p/ f/ Z8 L( @% m
s3 p# q( g6 ^: x
subs_filter_types
& b, L3 Q) m2 t2 y* H( S- J syntax: *subs_filter_types mime-type [mime-types] *9 F$ x. E- \2 O* ]
' k9 ]+ G9 s8 ^ M; o( H% Zdefault: *subs_filter_types text/html*
- k* U* o& B) N4 A+ @
9 ^3 I- Y5 |9 \" _) N- Mcontext: *http, server, location*1 L0 N- r$ v8 q: D) l2 G
/ P( F ~- z. A1 ]+ B*subs_filter_types* is used to specify which content types should be' f H( g& D3 @ y. g% z1 E% \0 R
checked for *subs_filter*. The default is only *text/html*.2 X3 ?4 ?9 ~+ c) G3 P* j( `
" N2 n& A) w4 G a( {2 f
This module just works with plain text. If the response is compressed,! h' N+ w+ H6 d- E
it can’t uncompress the response and will ignore this response. This
0 K8 {8 e; V4 f module can be compatible with gzip filter module. But it will not work* i. A7 U7 J. Q7 ]" v+ B( H
with proxy compressed response. You can disable the compressed response
, c f8 k* l! K( ^* n6 X# ] like this:8 E8 p3 q1 ~# K- v2 ~
9 f* t6 \# ^) U+ E" J; r: D
proxy_set_header Accept-Encoding “”;
7 V2 y5 |3 u2 b: Z
" F1 y: t2 X! y) L好吧,原来是没指定替换类型,默认只替换html
' T; o% S2 c# x4 ?0 `8 X+ K+ b- e! w& y2 l2 Q, Z
在nginx站点配置中加入下面代码:
8 a& L2 h/ o; r" A, {
4 m* U: E/ r% b; I3 u! C" Q$ h subs_filter_types text/css text/xml application/xhtml+xml application/xml;' l' s- O3 Y0 V- q7 B
) Y) @" Q3 P! n 重启nginx就解决了+ G# j6 E9 a* j
|