反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。" G ?8 J0 d: f/ F
7 L% m$ l4 s: R/ H一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
1 S/ `0 E- g' }2 F, L2 T
% k& w& Q) N: n: R6 k7 ^; y打开ngx_http_substitutions_filter_module的github看到: Q: j- U! Y- [. B$ r& x2 v
2 s0 R1 K' @ P @subs_filter_types: i9 y8 M; m+ v6 I3 @ a3 e
syntax: *subs_filter_types mime-type [mime-types] *
' Y6 ~# Q7 Y. p$ R+ w* u. @+ R* u
default: *subs_filter_types text/html*
( o2 ]: E; E+ d' X, |
0 `* i8 m$ ^7 ucontext: *http, server, location*6 y, Q6 _; A S' |
/ U! ~; o# v$ w' O% A: V1 R$ h
*subs_filter_types* is used to specify which content types should be
, Q0 _+ v9 L) |9 V2 @* B checked for *subs_filter*. The default is only *text/html*.
% c# w6 ]! m4 V Q2 H* S
; N6 ?0 j+ d+ kThis module just works with plain text. If the response is compressed,& q- Y( C4 C8 S4 Q
it can’t uncompress the response and will ignore this response. This, W! M8 m, Q( x$ I; @- @
module can be compatible with gzip filter module. But it will not work
' k6 J0 ~/ y2 }4 T9 x with proxy compressed response. You can disable the compressed response
9 T6 ]* g9 M' n# o like this:
! Q: q- E" `3 f' g( n, J X S( H' G) p1 F; c
proxy_set_header Accept-Encoding “”;
4 @9 y" Z4 Q6 q( }$ t5 N# F$ t$ E: @$ j: U0 u& a/ @
好吧,原来是没指定替换类型,默认只替换html% N7 {' i3 O9 T- } \0 W
6 c0 E+ W& F h: ~% r' [) H, e在nginx站点配置中加入下面代码:
( m3 L& I* h S3 F1 t: b8 Y6 X; p$ k2 [0 U( |4 S1 e
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
: P, ]0 j% V1 p
! ] n! j2 j& c6 f! [* M9 { 重启nginx就解决了$ [4 b# Y4 Y& ]1 l/ y: h) G
|