反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。0 e2 B) m" h$ P. N
$ M- \: I# r. `% K( i0 K) M一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
) n4 r. a1 l H: e
# H. A1 _9 b t/ H8 a m) r9 |' Q打开ngx_http_substitutions_filter_module的github看到:
1 V# Y+ O# h4 ^6 U. U& w
8 X i5 `, @( N' W1 t- ~subs_filter_types; ]; e0 p, n% S2 Q9 S4 r
syntax: *subs_filter_types mime-type [mime-types] *
9 U) o4 v6 e. x5 r3 N$ h7 m, k7 Q! r0 x9 d9 E7 `+ s* ]
default: *subs_filter_types text/html*
6 t) J! e: `: X9 o `8 @' ?1 B+ b8 R0 A; A; o/ m$ Y& r5 U
context: *http, server, location*$ W; K& T: ]- a5 }
- I3 H7 W% i1 ]9 T) x5 A*subs_filter_types* is used to specify which content types should be
4 `- W5 c( n7 x+ A- ] checked for *subs_filter*. The default is only *text/html*.
2 D+ D$ M; `& ~, ^ N5 W
. C3 d$ Z2 L0 [! B( @$ B. RThis module just works with plain text. If the response is compressed,( t) M/ B/ k$ F, e3 {" K. ~
it can’t uncompress the response and will ignore this response. This& f* y4 p" W" J4 T% U Z) R
module can be compatible with gzip filter module. But it will not work
0 T, L* B% i. {: X* {. X with proxy compressed response. You can disable the compressed response
2 E0 \! @( s+ w like this:
' I/ Q) M0 ?$ x. y; e
5 z; Q' u6 ` y5 Vproxy_set_header Accept-Encoding “”; 3 U4 k, P) {8 R- p
# |. [. P9 C4 }$ o8 |" e# T- k% ^
好吧,原来是没指定替换类型,默认只替换html" R \) ^1 n0 o* P& T P- X8 E
+ t% c1 g; o4 J' K8 _+ I
在nginx站点配置中加入下面代码:+ I- D4 E( w! l! S+ V
$ W3 ?/ i2 N }# X4 J* f2 [6 o subs_filter_types text/css text/xml application/xhtml+xml application/xml;/ g7 |5 V6 H7 T6 S/ m: A: a' @! m/ N
) E" m N+ J& J, V
重启nginx就解决了6 C" i! U- T6 b" d, s
|