反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。+ u& T6 M# W0 W$ V. z) ?7 U: O4 r
7 @! Z' z$ h' _) J1 L一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
; F: j# z: W' h" n% A3 V" v; m6 W. E1 j9 n
打开ngx_http_substitutions_filter_module的github看到:
[6 H0 x( m1 ~+ e; R
4 U, W& }# B# V. Osubs_filter_types; a7 V2 H/ f9 o) `
syntax: *subs_filter_types mime-type [mime-types] *
n! Z+ e p- |9 m: _. y1 f' _* d
4 i8 g4 H. b8 j) E1 I7 \% E s4 Idefault: *subs_filter_types text/html*1 K8 {) d d8 a* J
6 h7 L, |+ h2 m4 V' X* C! H
context: *http, server, location* R/ `2 t! D4 i1 K" ]
0 g% ~3 ?0 ^% T6 M0 X9 c
*subs_filter_types* is used to specify which content types should be6 w: |7 J- O( z" O
checked for *subs_filter*. The default is only *text/html*.
+ z2 t* B' k6 u: I' ? v% T# |' w% U4 J0 }: A
This module just works with plain text. If the response is compressed,
( j; R0 h1 O; j3 d it can’t uncompress the response and will ignore this response. This
: z8 o5 I. w. G9 |4 r$ v8 p& U module can be compatible with gzip filter module. But it will not work* n: x: k* n c) g9 Y( A0 |. b
with proxy compressed response. You can disable the compressed response
4 G$ g1 E0 T" g% n$ { u1 y like this:
}2 V8 F3 m( g
+ D: O- ~( R, Z4 X Hproxy_set_header Accept-Encoding “”; " i+ s. Z* F9 u' Q
R7 ^: d: b9 y3 `( r) ?: C! o好吧,原来是没指定替换类型,默认只替换html* e7 C* ? d( A& [) X S+ P: q# e o
. c- p1 p! p9 P9 L2 y
在nginx站点配置中加入下面代码:
( f5 |7 m% Y* |9 _" p. z1 F$ x( X& I) P% I; d% w
subs_filter_types text/css text/xml application/xhtml+xml application/xml;& z4 C* y/ H0 Q( _5 C+ V" p: `
$ N2 w8 @% x$ M( P+ P" ]
重启nginx就解决了' r6 W3 }; C ]4 f3 c) B4 a
|