反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。4 r% a9 B! u8 h w" U
n. C: C' w1 l' N一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
G/ d6 j. L: {7 c5 E. y' v |7 a
打开ngx_http_substitutions_filter_module的github看到:/ y* N4 I. `/ f
. u" r) p. b+ W2 P1 `. M( Rsubs_filter_types
2 R4 s/ |5 I0 e syntax: *subs_filter_types mime-type [mime-types] *
+ w. v& W3 N a. u' \, h4 e3 P2 W1 D- c7 N2 c" j
default: *subs_filter_types text/html*
9 f0 _: ]+ S T9 f! }; D; @ a( M7 C9 g' P1 k0 t
context: *http, server, location*
, B n9 q% T) }7 ~( F/ m0 }* {7 S
*subs_filter_types* is used to specify which content types should be6 v+ |7 _6 \0 s: Y5 v' Q9 w3 t9 _) |1 O
checked for *subs_filter*. The default is only *text/html*.
: t7 d3 ?3 y6 q2 u9 P/ d" m0 m) p: F6 J4 V' v& c' K4 x( ^
This module just works with plain text. If the response is compressed,# J# _- m! S0 T8 k. v0 U
it can’t uncompress the response and will ignore this response. This
5 Q l( l) }# B; S; S module can be compatible with gzip filter module. But it will not work
; Q+ A) d# @1 {, H8 t with proxy compressed response. You can disable the compressed response1 x9 k8 a( t: ]0 C3 ~
like this:. i) l- Q6 n5 Z+ E6 @! {
. D p q8 W( }2 g/ x7 v8 \# p2 i3 e; zproxy_set_header Accept-Encoding “”;
& o8 x7 G5 t" o2 a S# ~# q" P4 T- y5 E" L
好吧,原来是没指定替换类型,默认只替换html
5 K- R: ~. C, P; S. S+ k! |! L- n1 u' B* s6 c' h
在nginx站点配置中加入下面代码:, _+ X! ~ v; N V6 i$ p
. N* j, B6 J: k) M W$ N
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
* E( H3 i& C6 \0 v4 [/ Z3 b% T3 H; A6 M0 Q
重启nginx就解决了
% E$ [ T" }& K# }+ o: K |