反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
9 T6 w/ S* k2 j! o) I7 D4 U; e: r3 I) I0 P5 q% ~6 ~" U* o2 }
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
8 l6 a5 ?5 f H, r; ^& z- o* T: ^9 ^
打开ngx_http_substitutions_filter_module的github看到:% X+ k* B2 k4 w* D; n
9 m2 \9 ~: V2 j7 e
subs_filter_types6 M+ l5 Q/ h+ T
syntax: *subs_filter_types mime-type [mime-types] *3 g5 S+ G2 }3 _# E; N2 ] X
' U6 d( I' h" b5 I" K. ndefault: *subs_filter_types text/html*1 e* t7 a3 W# S: w: @
' w5 M) k4 N4 F1 N- Y3 x' Scontext: *http, server, location*% x; F+ j3 s. l5 u
2 [* T$ h# W& x5 a6 _*subs_filter_types* is used to specify which content types should be1 b5 j: H; `) { ?
checked for *subs_filter*. The default is only *text/html*.4 u8 S$ u4 e y1 L
& H' S! [0 ~' A' {This module just works with plain text. If the response is compressed,: b' p0 a0 F" F" R$ X; A
it can’t uncompress the response and will ignore this response. This
8 p# q# c6 M2 A( f' s module can be compatible with gzip filter module. But it will not work. J( a$ u' y) o- E* o6 h
with proxy compressed response. You can disable the compressed response% J1 m0 k7 t2 W& E
like this:4 n& i) @9 B7 L1 I1 z- D
8 p) J, m9 ]- q3 ~% Fproxy_set_header Accept-Encoding “”;
4 C6 N7 o# X; W1 ], J9 R' }1 j ~5 {8 I+ m8 b* d s
好吧,原来是没指定替换类型,默认只替换html8 E; }' j7 P: J6 t
+ y2 p, k) e2 q( S2 o( p在nginx站点配置中加入下面代码:
+ X5 b5 k' U) E |) _2 t
1 t3 l1 y2 G% ?) u1 O subs_filter_types text/css text/xml application/xhtml+xml application/xml;: J; t( l% l; T5 S
! B' W' N8 _/ [7 T/ v. D8 Z$ [ 重启nginx就解决了4 _: G5 W( \* C7 D
|