反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
3 D! [; N2 ~# M
# L* k( w" E7 H4 m% I# b; n$ S一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
, K6 ?! u* F( q6 B! Q
5 Q1 `: b2 q0 l6 B; A- ~( o% ]打开ngx_http_substitutions_filter_module的github看到:: {8 {9 t0 v6 l, R0 M
# M! F& N; N. K' E. @. }
subs_filter_types% I, o5 W1 Q0 l% k# |1 O
syntax: *subs_filter_types mime-type [mime-types] *. Z. r; s& T" R2 W5 E+ u W
$ X5 ?0 `# j4 Q# \, c0 R6 Qdefault: *subs_filter_types text/html** Q. V3 y3 h/ l. p9 J* c
/ ?9 m8 W" y4 O; X+ ]) Dcontext: *http, server, location*
: I) d( \8 k8 n/ J. U" \+ l4 D2 G0 d+ X
*subs_filter_types* is used to specify which content types should be
U7 o& o& n; [) Z: v, e$ Q* x checked for *subs_filter*. The default is only *text/html*.. p; O1 a6 `/ B
* f" J; G7 h% B2 g& Z& _This module just works with plain text. If the response is compressed,! a. y+ R: S( D {
it can’t uncompress the response and will ignore this response. This% ]" f1 Y- {4 o. ]4 j+ j
module can be compatible with gzip filter module. But it will not work
7 t/ B2 e. Z/ h* Y" q% ] with proxy compressed response. You can disable the compressed response, P9 Q" ~3 ~& d) T. u7 o
like this:
' G: S! i& s) @/ f7 h/ T# O
6 x7 [; Q& X: M* I0 _proxy_set_header Accept-Encoding “”; . J. w; k" o7 E
- E# o- p: p) J; b/ M好吧,原来是没指定替换类型,默认只替换html
P7 A9 n% ~0 ]; V
' A; C$ Z8 r/ ]' W* f在nginx站点配置中加入下面代码:
2 x# E8 u: M. W( Y4 ^( R( ]- |5 r" o' [( l
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
3 s2 i4 R9 ^/ c9 t4 t
" x" ^! g. R/ ]' @. ]' q 重启nginx就解决了8 {) u* @3 ]) G6 J, c
|