反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。# f! S5 G2 U+ [, `. _) s( N
. w# u) a# o4 d/ c一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
/ n @. i4 O" C- Y# Q& m9 I* E, g; U/ E
打开ngx_http_substitutions_filter_module的github看到:
$ ~; | A7 f9 x: F9 S3 X- Q; P' |
subs_filter_types
! A4 k2 q1 J, ]% D- k syntax: *subs_filter_types mime-type [mime-types] *
4 C$ } P5 E; }+ s: C% R% e7 S) o1 I" `: }5 X
default: *subs_filter_types text/html*5 E8 c* i; E. I$ z. Q
9 b5 d9 }6 n8 x. k8 a+ Q7 T: H/ ~
context: *http, server, location*$ V. u2 p% R( i7 |! i8 L
y: W' s6 I- ^6 y4 w7 A+ H4 v*subs_filter_types* is used to specify which content types should be
7 |, r& G5 k7 `" T+ a! _& M; T, q* T checked for *subs_filter*. The default is only *text/html*.
% L$ {$ P! |* _% y8 G' s3 k. X
1 u& J4 n/ }6 |8 g1 hThis module just works with plain text. If the response is compressed,9 G L! F: u/ [, r) T
it can’t uncompress the response and will ignore this response. This
+ H5 x, m* F5 N: r y# m% M module can be compatible with gzip filter module. But it will not work. |6 R; h# L) t, I
with proxy compressed response. You can disable the compressed response. F* R1 j$ x/ o/ l" ` \; B
like this:
3 Z9 T. ]6 ^0 Y
- A% D& k; ]+ l1 M& P- p4 O2 \proxy_set_header Accept-Encoding “”;
' v8 Y) g7 \7 T; ~ G" |* ?' R! L0 ?$ M" q6 m6 [( a0 K% c! j( |! Z }
好吧,原来是没指定替换类型,默认只替换html. n9 V5 N2 g& @ y$ S; A" B& L2 p# S
. l: H* @7 V8 p, x0 A. Y3 ~# n. _7 K在nginx站点配置中加入下面代码:
5 [2 Q* d/ r M9 R0 Z; t( C, X+ a5 E9 U9 T5 f- V
subs_filter_types text/css text/xml application/xhtml+xml application/xml;( ?$ D" O& l* \2 O3 D0 D
; R# P' N; w e) z 重启nginx就解决了# T) `5 f6 T3 D/ e/ t$ w
|