反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
, {! R4 K* V7 I' t4 D, u/ F% \) h6 H: P
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
# M" X$ Q# |" c2 N! {- r
$ e0 h4 v5 `$ X) s$ l8 _- O8 K打开ngx_http_substitutions_filter_module的github看到:3 i' v! z3 u6 y
/ [, m3 l5 {$ d! c( g* K0 b
subs_filter_types
+ }( r; F1 y- b/ v+ R syntax: *subs_filter_types mime-type [mime-types] *
* K! w! {, b' w1 p) \% s; E5 Y6 X( f. q
default: *subs_filter_types text/html*5 q( |% P) p3 X, Q
2 h8 v+ A9 F' U; n8 Icontext: *http, server, location*, y* @" V# m; n/ ^' k2 o' K# X3 A$ }
6 L' R6 ^% P/ ]' H) }- u*subs_filter_types* is used to specify which content types should be
3 _7 J) C. a: j; ^5 ` checked for *subs_filter*. The default is only *text/html*./ Y& t. ^" [0 J& n# P
2 }7 ^; d' e4 v; J
This module just works with plain text. If the response is compressed,: \0 G7 Z/ q$ [' ~2 V% a; M
it can’t uncompress the response and will ignore this response. This
* e: j9 n) J' X0 A% F/ p module can be compatible with gzip filter module. But it will not work
, i6 p% u0 B' y5 H; a4 [' R% W with proxy compressed response. You can disable the compressed response
z: y: u( e* K. F like this:2 }6 t$ z/ |2 D# m
; O4 X& B( V5 @% K- y
proxy_set_header Accept-Encoding “”; * G) j: q0 F5 ^: [ ^
/ x. I/ m3 d2 D6 E/ f6 ^5 {9 @) F& U好吧,原来是没指定替换类型,默认只替换html( [% S+ O! n' b `) _: V
! {* D5 h" T" M- N, V5 V& ]$ d+ t
在nginx站点配置中加入下面代码:
" Y5 G. a1 u5 E' e! r
/ Z# B$ B1 H$ ] subs_filter_types text/css text/xml application/xhtml+xml application/xml;
* l! S5 R, Z8 z0 ^
. j* K' m/ q6 R j5 l1 Z 重启nginx就解决了
; H2 o6 w5 G# J; K |