反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
& k7 A& s" h2 F2 U
; U) o4 E( g* f/ v一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
0 w9 P+ ~0 P% ]! l" |
6 i$ R6 O* s1 i, ?; `& g; ^, a0 N2 s打开ngx_http_substitutions_filter_module的github看到:
5 b! @' C% o3 Z B- V7 H2 u# k6 d
subs_filter_types
& G9 K* E3 j) ` syntax: *subs_filter_types mime-type [mime-types] *
8 `3 K( P3 A9 o: y& c G7 `" M% S# B8 @
default: *subs_filter_types text/html*
! q0 L C: z5 K1 z
2 C; h# {+ N6 ]. k Y# z9 i/ gcontext: *http, server, location*
2 W) h9 U: q, N2 u) Z7 M4 `3 _( F* ]( M3 ~+ e' Q
*subs_filter_types* is used to specify which content types should be6 n8 B2 G/ k* s- \. {
checked for *subs_filter*. The default is only *text/html*.5 n& l+ E9 ?( F+ C
5 v3 }# R; P+ Z
This module just works with plain text. If the response is compressed,0 `6 ^& ]5 a+ p) {8 W) Z: K4 o
it can’t uncompress the response and will ignore this response. This' @! Z& k; @: R v( b6 }
module can be compatible with gzip filter module. But it will not work& B2 S& @6 @. i
with proxy compressed response. You can disable the compressed response) I9 ]5 |( y, w) f0 b- i3 k0 [1 q$ o8 t
like this:
, {) I, M1 \! T
% @' \" X7 c' J- q- b* qproxy_set_header Accept-Encoding “”; ' i/ {5 I2 M4 [& M1 x
4 \1 S9 r$ V$ n W& ?好吧,原来是没指定替换类型,默认只替换html
1 A, [# i' e$ l- }7 g g0 T
1 F0 x; v# q Q$ W I) L" ^# c在nginx站点配置中加入下面代码:
6 f2 c, [6 q8 G) m7 B- l0 Y0 G+ h! m6 T3 |
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
) _+ }# a( P9 ^/ D; a' K/ x$ @( V* m2 |$ {% m3 f. Y: g
重启nginx就解决了9 J' |: w( g: U! m
|