反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。, W) @+ p4 C; [" }9 _
( P a) C: [% D; E+ h一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
; f# O3 r7 C( n$ S) f& J: D0 h6 h, l+ G2 M
打开ngx_http_substitutions_filter_module的github看到:8 I! H5 ~7 p% _! _6 L' A- f) K2 e1 f
# V) o& g( T' [( r( Ksubs_filter_types
2 Y/ i" E2 s# t* D8 g syntax: *subs_filter_types mime-type [mime-types] *# y: f' [$ H2 P0 ?; R3 [
6 V( _# B: d: f0 Z" S" v
default: *subs_filter_types text/html*2 {/ D" ~" ~8 D- e
/ _, z9 l* o- [7 ]3 N9 fcontext: *http, server, location*5 `" [, H0 U# ^. R: f) \
. a2 F. R! H5 O* [0 c9 |- D
*subs_filter_types* is used to specify which content types should be
* Y a. e0 J! X. W" s& k: s. ^3 S checked for *subs_filter*. The default is only *text/html*.! P0 ^0 T" v3 Q) b; m3 b6 L
, u5 b* G# V( K& v# m7 n
This module just works with plain text. If the response is compressed,
7 r( V' [" L, M- K3 p2 U it can’t uncompress the response and will ignore this response. This
. B# h' o8 K- k5 q3 ~+ v6 ? f! u$ q module can be compatible with gzip filter module. But it will not work6 K2 r. A0 R( D: q
with proxy compressed response. You can disable the compressed response
7 V5 h$ }: K% h! F like this: ?0 {+ R6 j' G$ B, p+ ^; |! X3 R
$ o1 [* a- u( M# U9 [* ]
proxy_set_header Accept-Encoding “”;
. j* h1 ]* d8 r/ U$ F1 r# `( f
好吧,原来是没指定替换类型,默认只替换html1 n$ M% j( y; h# K/ `6 ?, \
- K0 P% c3 }6 G8 T' U在nginx站点配置中加入下面代码:
- r/ f6 p- L5 \- w& Z$ i
; ~( W* q @1 B* k% E% d subs_filter_types text/css text/xml application/xhtml+xml application/xml;+ g% ~+ c: Q0 V/ j( u9 W
F! j1 F) C1 j+ A6 N4 x 重启nginx就解决了* }# C# o, H! T9 _
|