反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
p: ~ Z* R7 y! J$ @) ?
# v5 i1 O, \( y一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….) U9 O# I4 A) H3 e
% G+ x0 H7 m% B( q' S打开ngx_http_substitutions_filter_module的github看到:
& r4 o) F/ Y1 e0 [) F1 `: G
7 P6 ?4 D' [0 i/ f4 Isubs_filter_types1 e8 w) q8 X+ q. ~7 D8 C
syntax: *subs_filter_types mime-type [mime-types] *$ w5 p! v6 Q- f9 o# K
: I, k, N. a- W6 P% Q4 Odefault: *subs_filter_types text/html*
' l8 ?" D3 \/ j* f$ ~6 z' d9 R/ T0 ?, J, @! O+ W
context: *http, server, location*
4 Q9 z. v q7 }) _9 Q8 o- {6 k8 x& H- T1 k# {- C5 n
*subs_filter_types* is used to specify which content types should be9 Y* i' z0 V+ p% C' V0 s# ^
checked for *subs_filter*. The default is only *text/html*.' k6 |- L+ D3 u; g; Y* }9 L3 [
, I+ M7 y. U+ c; X1 R) Q( K% AThis module just works with plain text. If the response is compressed,: o$ m/ H* V0 b& L
it can’t uncompress the response and will ignore this response. This! T7 k% n; S" z" ]% ]' R' S
module can be compatible with gzip filter module. But it will not work
- ]! \! z: |6 J u$ C' j$ G with proxy compressed response. You can disable the compressed response; \2 ?/ S- @1 ?. O1 V0 e- A
like this:9 n* L& U0 B: Y U& V8 B! m* O
$ C: P2 k0 y% v3 S4 U7 _6 z) T4 kproxy_set_header Accept-Encoding “”; ' s1 C! q: X% C8 Z3 s
3 f+ a; I# h! }3 {) N+ D y好吧,原来是没指定替换类型,默认只替换html
, e1 W; c* a2 N' t* `# H" U" U, V2 |& W
在nginx站点配置中加入下面代码:+ \5 s% Y2 ?+ Z
- Z' @4 } B) f, t; ]% O0 Q: I
subs_filter_types text/css text/xml application/xhtml+xml application/xml;5 ~# w0 B! F: b; _, s" j
) u7 x! C. E1 n. x- [
重启nginx就解决了
$ r$ i$ h$ |/ w |