反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
V( i3 i6 V# t' s+ c9 _5 S- i
a, {0 f! s; x+ f4 a一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)2 l* u0 q' `! I& t7 }( h
/ Q6 h) @9 [9 Z H1 l6 i8 J. i- q6 C. v
打开ngx_http_substitutions_filter_module的github看到:
1 y1 \: K+ B2 h: h4 v
5 i# d4 `% X5 Y: nsubs_filter_types
}: Y( G# X# d$ w syntax: *subs_filter_types mime-type [mime-types] *
1 F; x/ ^# b! v, j
* ?! ? R& U* Fdefault: *subs_filter_types text/html*
5 ]% U1 l( G) P7 j1 N* {/ G4 _
' O' F! |3 T$ C6 d7 N* Pcontext: *http, server, location*5 Q( K* m' F; f' m$ L
! C, m# h/ _4 [8 w* S# \6 P: O7 ~
*subs_filter_types* is used to specify which content types should be' b. {* t0 j3 H5 h2 M+ [, b8 K% K/ t
checked for *subs_filter*. The default is only *text/html*.; k' Z9 ]( R, B) `1 n
. b" \/ O8 ~' f7 R. e) H
This module just works with plain text. If the response is compressed,
, q8 e/ \) U8 [1 m4 } it can’t uncompress the response and will ignore this response. This6 H3 P1 x. {1 J
module can be compatible with gzip filter module. But it will not work: \9 Q8 [$ W/ A) d; q
with proxy compressed response. You can disable the compressed response4 n/ T5 m4 Q( r4 E6 Q2 F
like this:: N+ g! ~, u" g* _- F+ Y2 u* p
# v; I9 C4 j/ T+ D# N) U; [' Z; @1 Nproxy_set_header Accept-Encoding “”; ; }; H9 l% Z' F/ Q% @! \2 V: c; X6 F
3 A$ a4 O0 Q& n6 e好吧,原来是没指定替换类型,默认只替换html
8 f0 t7 c/ D: \: T
( ?/ m6 k" Q: W8 g! }+ ?在nginx站点配置中加入下面代码:5 }1 n+ G5 I9 I! ^8 n
- e! ?7 O- o/ l# B subs_filter_types text/css text/xml application/xhtml+xml application/xml;/ z H: h+ M1 z
( R2 b! ~/ x: L7 Z 重启nginx就解决了" v4 d& K3 ]1 W4 i
|