反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。5 X. g) K: {' J
- o: w; c6 T d
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)6 `+ e8 @2 G0 [7 D
# x0 Y; M6 t7 B+ N! e' {
打开ngx_http_substitutions_filter_module的github看到:
9 E3 ?4 k' Y3 ~" u/ C1 A
( Y; o, f v- csubs_filter_types: t0 q8 Z% h9 ^% w, u
syntax: *subs_filter_types mime-type [mime-types] *
* {: i1 H s1 A: \' |% @! A9 N! }; v# d. ]% W0 G3 l! w5 v! r
default: *subs_filter_types text/html*
5 T7 A) M3 Z% o6 C" ~) a# ^4 e7 |; c: U
context: *http, server, location*. p# f2 ?* }9 H& s2 `
% f* E- C* J( V
*subs_filter_types* is used to specify which content types should be
3 o; E, \/ X; i4 v9 r checked for *subs_filter*. The default is only *text/html*.
$ h4 d; A4 M( ]3 ^/ Q9 E
7 `( N# n$ k3 GThis module just works with plain text. If the response is compressed,
/ {8 D" `% X. n it can’t uncompress the response and will ignore this response. This& f* [6 [, p" y7 e0 d9 i
module can be compatible with gzip filter module. But it will not work$ t; [6 T9 D, Q( R2 m! [
with proxy compressed response. You can disable the compressed response
4 R0 a1 t9 c7 Z, l. E: a1 p like this:9 C3 a- Z, X. i
l; R6 t i% V% [
proxy_set_header Accept-Encoding “”;
: u8 F" e |2 J! c( b: |5 C! i0 I9 \" d" L
好吧,原来是没指定替换类型,默认只替换html2 t: Q7 R+ U/ U* p
# I$ @4 ]! v+ b+ @: Z% |4 O% d在nginx站点配置中加入下面代码:" m& i$ f# o+ V' m
, [9 Q8 Q. T" ^' d( m subs_filter_types text/css text/xml application/xhtml+xml application/xml; }7 D3 I: q* m3 z1 p/ H3 V
6 l/ V: X# Q, w
重启nginx就解决了
, e8 d4 H' p& x" z' d2 y! H3 J6 Q |