反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。; M" U! N& d9 J" k; z1 n
# x3 p" f+ j8 O1 `4 |. c! O# |$ n一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)7 b, W8 X! ?' }$ t! l v$ X2 c
/ }# v) J/ }7 \7 @7 T. Y! }打开ngx_http_substitutions_filter_module的github看到:
7 O7 e* W7 a# M
2 W$ P v/ @. q/ bsubs_filter_types3 R# @1 O7 J r$ @# f# @
syntax: *subs_filter_types mime-type [mime-types] *
5 T4 y2 _) z5 D6 G: H) S, o: D t! X; X" O; o
default: *subs_filter_types text/html*
3 Y0 p. Q0 N) E; t) g P N$ N D0 h2 _ y! p
context: *http, server, location*4 `1 q; }$ o/ n2 i
( Z) y# P5 q# P2 ]
*subs_filter_types* is used to specify which content types should be+ ?) ]( C3 {( U" R& s
checked for *subs_filter*. The default is only *text/html*.+ V$ B( k( r. |$ t) B. {
" P/ z; {( X0 H' j) y3 ~! AThis module just works with plain text. If the response is compressed,
- o4 l3 r) D) J3 i4 w it can’t uncompress the response and will ignore this response. This; e7 l# Z5 J5 R( x# r( w( o
module can be compatible with gzip filter module. But it will not work
- c3 |; i3 n3 e$ B& U: l0 E! g4 w with proxy compressed response. You can disable the compressed response: I/ h( j. j! \; s
like this:+ p. g3 m' U. T' D$ i( R& G5 w, w
4 Q. ?0 J5 U* r/ T- Y0 }proxy_set_header Accept-Encoding “”; ) P! D+ r- b! F* q7 r
# X# Z: D7 i5 H2 w. f
好吧,原来是没指定替换类型,默认只替换html
* M) D- o# n* S4 G3 E9 O- P. {+ @3 S
在nginx站点配置中加入下面代码:
3 r6 K( h7 ]+ T6 A- ?5 [ r1 a) s% w( D1 h% y
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
7 P) Q! P' k: t+ W8 m! J4 | Y3 }. U3 b
重启nginx就解决了5 z: j5 w- i/ A' Q. e8 E( }+ D
|