反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
7 k, G. x# a% i" u+ s" Z' w ^3 y' i; g, b
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)) O1 v: A* v/ x8 H1 K/ O4 f6 a
. ~4 ^8 ^+ ~8 X: C+ [5 m1 u
打开ngx_http_substitutions_filter_module的github看到:7 q$ A+ i# ^8 g' b
, ]8 ]- I: s- X! j
subs_filter_types
' c. E; ]# o& Z syntax: *subs_filter_types mime-type [mime-types] *, d' l. |7 N6 m7 g- ?7 k4 ~3 U
5 q* s" F7 A3 q9 Z+ kdefault: *subs_filter_types text/html* a- D' z. N, h' f+ e* `
) r/ H: C4 I5 l6 x- pcontext: *http, server, location*
8 j3 l0 i7 y. Q+ o% O# L0 g4 H
8 v$ Z# D# D0 {5 c. m% b9 P*subs_filter_types* is used to specify which content types should be; ]/ i6 J: X9 z+ T2 u# k
checked for *subs_filter*. The default is only *text/html*.1 A* Y/ G) m% r
% I; X2 Q' D! b' \) D, }3 J fThis module just works with plain text. If the response is compressed,4 R# R; L; |( \
it can’t uncompress the response and will ignore this response. This
& Y/ S: u) h/ p, v5 i6 E# R; V' _7 y module can be compatible with gzip filter module. But it will not work7 u3 Q! r# d; J, ]$ e# _
with proxy compressed response. You can disable the compressed response! Q' R1 {6 U* J- p
like this:: V. A ^: \' N) w+ L7 a& l; Q
1 O, T+ z8 n$ f% I$ _$ H6 q: z
proxy_set_header Accept-Encoding “”;
* U$ D" q! d7 T C% ]; i
1 x% C! a# R7 d6 n8 P5 z* V好吧,原来是没指定替换类型,默认只替换html
8 z, z$ Z3 P0 W7 O# y" S: N% w
" Y6 }' h8 F4 p- _2 M1 L" I% ]在nginx站点配置中加入下面代码:8 E- Z3 y/ n; x& U9 W0 ~
0 n3 o) q8 e7 L% B5 ~3 o subs_filter_types text/css text/xml application/xhtml+xml application/xml;
2 T& r% u. c$ ?( o j' k( N; a7 b# _+ k
重启nginx就解决了
0 [6 |% V0 H$ q# ]- u |