反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。. r& ~) Y' O- _& o( m* s3 r
8 U8 ? e$ V3 b* H$ V/ A8 Y一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
2 }; j2 G; _& |, ~
9 Z3 X# E5 x Y( H) G7 I打开ngx_http_substitutions_filter_module的github看到:
+ U5 O1 [, A( n+ z5 H. g+ M; Q: Z8 I! D
subs_filter_types
0 V0 G6 ^& Q. @/ u3 E; j R: b syntax: *subs_filter_types mime-type [mime-types] *% O( b" E# K3 p |5 K
& l; E; r/ s# a: k
default: *subs_filter_types text/html*' ~/ R- O# ?5 m' w3 m% j( k! c
: I+ l0 o" F1 M5 [1 icontext: *http, server, location*$ Z) Z, O: U# U8 _/ B: S. Z5 q
* \, c/ I( y8 z: @7 d
*subs_filter_types* is used to specify which content types should be
1 N$ L _& c: f* Z4 } checked for *subs_filter*. The default is only *text/html*.0 I F2 z* d# j# ]4 y& z
, n* l8 I ^: X5 q3 B
This module just works with plain text. If the response is compressed,9 _0 \& p% x5 X" x7 \- h# e2 t
it can’t uncompress the response and will ignore this response. This
O) _3 X, B2 z: I/ n2 G, f+ n module can be compatible with gzip filter module. But it will not work( C. l. g/ T; X0 B$ q: a
with proxy compressed response. You can disable the compressed response! z% U8 T$ s0 g
like this:
9 K) z; D4 ], }1 _
; B: F7 z* B5 Q# Bproxy_set_header Accept-Encoding “”; z9 v" i3 ]3 X2 l
" z! I: b. U! O
好吧,原来是没指定替换类型,默认只替换html
f; ]- ]" s, [& `2 ]2 S, z. i- g o+ w w& P+ u# a
在nginx站点配置中加入下面代码:
( V6 ?& F K3 y& X& ]4 ]' t/ q4 }, J, E H
subs_filter_types text/css text/xml application/xhtml+xml application/xml;9 G5 c' w$ @, _
" t+ w0 D/ g5 X2 S0 W; e 重启nginx就解决了# U8 j( P/ C5 w6 }
|