反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
/ v0 H5 g9 C! s4 z
7 j& s3 Z# N# @- Q1 C! Z, w一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
4 t7 t3 ~5 D! `& V8 O R2 t; g7 I: _! f' D3 {5 m' G/ y
打开ngx_http_substitutions_filter_module的github看到:
* {* d1 [( m6 c" A! _" F m
& D; n3 E; h% P% D: Ysubs_filter_types2 C& o1 S. t! |/ e+ p
syntax: *subs_filter_types mime-type [mime-types] *3 o3 R0 u! W9 ]7 r! f
3 m9 e. X- V$ _. Y+ Kdefault: *subs_filter_types text/html*& E' I' ]4 b0 n! g+ q! C
8 |8 C/ h- s/ S9 c
context: *http, server, location*2 s2 X# u1 r' y8 j3 a1 A
0 z- i) ~; H; ?*subs_filter_types* is used to specify which content types should be2 ?% {& ^! j; H' C
checked for *subs_filter*. The default is only *text/html*.: s) S' b; q+ N2 [
+ }( C9 L T' d7 U
This module just works with plain text. If the response is compressed,8 V' O; ~2 c9 H. |
it can’t uncompress the response and will ignore this response. This' o$ p7 F# s/ g. |
module can be compatible with gzip filter module. But it will not work2 E: \) G; h, }8 p
with proxy compressed response. You can disable the compressed response/ J* @2 Q# i& `" a- N
like this:
4 J* p& v0 d1 [% g3 S7 l3 _. m9 f7 {, ?6 {( F2 K) h
proxy_set_header Accept-Encoding “”; ! P* \4 @* M- {" `1 Z8 X
! W* d& G0 o- g7 G2 z# R5 M好吧,原来是没指定替换类型,默认只替换html
4 K8 D! Y& T6 {: f. }+ P( r' d
' u5 h, N" l6 t& r7 Q- G6 N0 |" x在nginx站点配置中加入下面代码:
/ {$ T% `' V3 @- `" X
& Q- v5 f# m/ V+ w9 L subs_filter_types text/css text/xml application/xhtml+xml application/xml;) d; C: k8 \5 j( X7 e8 O# `8 y, ^
) v) @& _7 G: E9 ^# z- Y 重启nginx就解决了
; u* ~& j# r$ M. m4 w, ^. ?9 P9 c |