反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
' I% b7 E2 i0 V7 M: |, h) {
/ r2 N9 F O r! {7 N0 q4 i一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
" \: R: F5 `: a
3 W% b2 O4 B+ P7 I打开ngx_http_substitutions_filter_module的github看到:0 f6 B# {) B! q! L
' J: a8 Z+ a; e- F. g$ bsubs_filter_types0 m% o( x1 I, r7 H" d- p
syntax: *subs_filter_types mime-type [mime-types] *: [" s1 ]4 |2 [ k |6 a* f& I
Z4 \, X& a! ~& |. Fdefault: *subs_filter_types text/html*: u* ?3 F0 ^, k6 |: L, d
" S5 ]2 M7 l9 o# }7 l* [
context: *http, server, location*! m$ ~. ]( h% F v
0 v: Z$ g1 o, C
*subs_filter_types* is used to specify which content types should be3 a# H% b, Z$ Y% e8 Y
checked for *subs_filter*. The default is only *text/html*.
$ p1 ?( t4 `/ k {2 z I) I5 D/ r5 [
This module just works with plain text. If the response is compressed,
1 y4 T# Y" q" q it can’t uncompress the response and will ignore this response. This
" [+ h. Z. }/ A# A% }$ Z; b, V+ }! ` module can be compatible with gzip filter module. But it will not work" _0 ?. ^1 X# g3 b
with proxy compressed response. You can disable the compressed response
6 D$ \1 S/ r4 e4 l, | like this:+ r7 H7 h# _, O& N0 t4 @
/ g% n, I3 X8 U/ x0 }# k) A
proxy_set_header Accept-Encoding “”; % m6 f; T: w3 z; u% @
( _' L1 l9 v0 s; F& N8 c/ U6 d9 z
好吧,原来是没指定替换类型,默认只替换html
* a: b# C- {9 P8 x! k
3 V# Z0 @; ~ w9 B# N在nginx站点配置中加入下面代码:6 A- a( i: p$ Y& S5 v% G' h# z
, s+ O7 B2 v! ]; V/ l- R7 X! u) r9 Q subs_filter_types text/css text/xml application/xhtml+xml application/xml;
d1 p: {; s" t y# X# q/ o' c: c6 e9 ?( {% r! D, \2 V
重启nginx就解决了! b+ ` g* I& a# G8 A! X' U9 N
|