找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13816|回复: 0

解决nginx反代Discuz论坛登录跳回源站的问题

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。2 S) \1 h/ l/ |" D7 s

3 E% h2 \4 b7 p6 w& f5 R% A一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
9 ?% {7 }! y6 h8 f$ ?
! R& G( }. Y3 m, l! u) Q# j打开ngx_http_substitutions_filter_module的github看到:: l3 i2 i( r- y8 {. x
* c; O7 p0 c+ N9 Y3 n$ ?
subs_filter_types
/ ~0 i/ R5 |; U% w9 x; f syntax: *subs_filter_types mime-type [mime-types] *0 r6 y/ G9 ?3 J6 O
& `5 _- k' h4 E5 G; H3 c: R3 a
default: *subs_filter_types text/html*+ _" Y5 G. V" G! t  E, t$ c# L
9 u0 I, q  A0 ^* u$ ?
context: *http, server, location*
+ I+ L, X8 I8 b) b& L1 x7 |% E1 @2 W8 y9 j' F. g
*subs_filter_types* is used to specify which content types should be5 }; D6 R- C& t+ \% Z' f- i
checked for *subs_filter*. The default is only *text/html*.
9 k- L4 q' [" x# r4 ]
5 L  \1 m$ }) W' `" IThis module just works with plain text. If the response is compressed,
) r1 ^4 e5 }" J  P it can’t uncompress the response and will ignore this response. This. ~) S( u. Y: |- Z1 a
module can be compatible with gzip filter module. But it will not work
' \% p8 T4 f- Z8 _# M( m5 c with proxy compressed response. You can disable the compressed response# A# E3 I1 O6 U
like this:
, M1 T' R/ _0 i# o/ A
) }. [. f9 y$ D0 H4 h5 Mproxy_set_header Accept-Encoding “”;

% @4 V0 b; i9 x6 N0 y/ q* N7 X, x
" Y* q; `) [1 v好吧,原来是没指定替换类型,默认只替换html7 w) N2 B4 c% W

/ b- K! _0 c: J4 u5 x" D8 b在nginx站点配置中加入下面代码:
2 q) [; k# x% O) R' d  n; N
4 E* T6 W/ C, S' Q3 _ subs_filter_types text/css text/xml application/xhtml+xml application/xml;
" J2 A3 \( H- [0 l* s, l% ~8 T
+ ~: f+ q* n1 _  k( Z3 s3 Q 重启nginx就解决了/ P! U' Y+ u+ j: j( q8 A5 |7 n$ z8 U
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2026-1-11 07:18 , Processed in 0.038621 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表