反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。) \9 W- ]- x" u$ ]2 ]
2 V8 E. o5 z& l6 g$ d7 J+ J" N
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
+ O) z, w+ W+ w$ l% j* G( ^. u% H( i! ~9 Z x8 P
打开ngx_http_substitutions_filter_module的github看到:7 }& `7 ^$ I. q4 s
5 i' {; q4 X- V) E: M
subs_filter_types# s9 s7 X: r. B* b
syntax: *subs_filter_types mime-type [mime-types] *6 f/ N l+ d: |$ w& Z3 L5 k
9 K" |5 O' h/ ~+ H( }7 \default: *subs_filter_types text/html*
% G* v( q- P& W \0 y8 p
( _6 b e3 K' G% y8 bcontext: *http, server, location*0 Y5 Q7 \7 U9 }5 [, C) u
, m; }+ s B/ }" _% y9 r
*subs_filter_types* is used to specify which content types should be* u4 Z1 o! {3 I0 S0 K, O7 W
checked for *subs_filter*. The default is only *text/html*.
1 A% ^* y! P. ~1 X% E
$ V2 p4 }: r) D# w+ [This module just works with plain text. If the response is compressed,
, d- R1 |- w; K it can’t uncompress the response and will ignore this response. This
0 E8 y# r: t$ V module can be compatible with gzip filter module. But it will not work0 _) }# k, i: L; c8 S( i# N
with proxy compressed response. You can disable the compressed response
! f+ W8 s, C2 T Z* {$ F like this:
2 ~( ~; N8 n4 I: l/ c
6 F2 P7 v$ K7 y9 a* Y" \ O: Jproxy_set_header Accept-Encoding “”;
5 v# h% K5 V9 d) q) Q$ _( p+ G$ t" O# e/ s9 V
好吧,原来是没指定替换类型,默认只替换html) }0 v3 v5 [2 R* P
% D/ Q6 f6 j2 u3 B; n, P* h" z- }
在nginx站点配置中加入下面代码:6 d) B2 [! H, `
& ^1 I/ f* B- ]( X+ f- _4 o$ Z% e subs_filter_types text/css text/xml application/xhtml+xml application/xml;" f& [: Y1 s$ D- Z, R3 ?9 a' O
4 `$ Q( k7 J, j# P+ [ 重启nginx就解决了
! u' @2 H( @: P, m" e$ K1 { |