反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。: T7 C. ]0 j$ K# d
. F! G+ S% C2 ~4 h9 ?. r; n: t
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
% e' @3 E r$ b) h* `5 N- z1 C, f) M0 y5 h
打开ngx_http_substitutions_filter_module的github看到:
( Q( j& b) c% j) p$ m
3 e2 i9 Q* C3 v4 D5 Usubs_filter_types; S. m; N$ n' o+ d+ F, i4 O
syntax: *subs_filter_types mime-type [mime-types] *
* T" ?% U- k. ?' ^5 W- u* T u
+ U, N: ^2 v5 u" Bdefault: *subs_filter_types text/html*4 Z1 d' K3 b7 Z: v$ b
& s6 G% H \- M D$ M: Kcontext: *http, server, location*
1 d, _4 P3 B) U, w5 p; U) E" }9 X3 w6 Q4 x& S# r1 G8 X
*subs_filter_types* is used to specify which content types should be: c( O- v3 q8 R; }+ J% e$ [6 U" I
checked for *subs_filter*. The default is only *text/html*.% D2 h b) L7 u# X! E
7 x' c( P ~( v( G
This module just works with plain text. If the response is compressed,
2 O+ Z. m" ?) [0 ?) v# k it can’t uncompress the response and will ignore this response. This$ f# v; G- d; S' \1 l
module can be compatible with gzip filter module. But it will not work
/ m# q2 E5 |1 U6 G6 l with proxy compressed response. You can disable the compressed response1 n8 ]" A2 w4 Y) \# T
like this: N( P/ e* C0 l/ K
* p+ G, Y9 R m t0 Rproxy_set_header Accept-Encoding “”;
. J: U0 L' ^; x+ n3 ?$ f6 U9 s4 I, {7 p, ~% \
好吧,原来是没指定替换类型,默认只替换html
" L: `) Z) w$ E% J* T2 ?# B. ]+ \% X) |' d. X! ]6 Q
在nginx站点配置中加入下面代码:6 N7 }5 ~: ~( N3 E0 y9 W/ ~) I
- O4 P& h: K/ j3 E4 \' w2 v subs_filter_types text/css text/xml application/xhtml+xml application/xml;/ r+ p7 v5 R4 t- s
( o& \$ k- l* S4 Y) b$ [4 y
重启nginx就解决了
, ?0 H" i6 F. K* P$ s |