找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14276|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
4 \7 m' j1 ?; a, a
+ w4 Z: @6 r9 j: v. p一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)3 [1 }3 N3 B% Z4 V* R% M2 o

) V/ J6 K5 I6 x# q6 Z打开ngx_http_substitutions_filter_module的github看到:" a9 d: o; o' m" m; n# @2 `* ]

; |1 a0 _! c4 F' K# l% d' H
subs_filter_types
' a3 s7 ?5 x9 E) h/ A! Y$ ~/ v- L syntax: *subs_filter_types mime-type [mime-types] *
: d5 k% A) O, ?
: \, `% U2 e9 H% ?- p! Fdefault: *subs_filter_types text/html*6 D7 Z0 Q: x( i1 o
# F, G/ M! l( @
context: *http, server, location*' c8 F9 Y! N" t: P8 @
3 D  ~. J2 J9 y
*subs_filter_types* is used to specify which content types should be
# Z6 L3 |& Z; G; Q; k: t checked for *subs_filter*. The default is only *text/html*.# l" f: U7 V2 Q- R+ ]) z/ g) k( E
+ c" Y& u3 t  v& D
This module just works with plain text. If the response is compressed,
# G& u0 B6 x' h7 W% G  J% | it can’t uncompress the response and will ignore this response. This/ N7 C3 R! ^7 T- i( j  M1 M. U
module can be compatible with gzip filter module. But it will not work8 D. P2 c  |0 k' L( x2 H& f$ I
with proxy compressed response. You can disable the compressed response
% }& Y( i& T) ?( a. X) p* l; ]& K4 w  b like this:
' ]0 e3 w7 d8 O9 `* @" M7 H; q6 M' E( y. }" u+ b
proxy_set_header Accept-Encoding “”;

9 w5 \) T3 I' L( d/ e0 {$ B2 s9 P2 R+ O) X/ Z( Q: a+ z! Y+ @
好吧,原来是没指定替换类型,默认只替换html& a: a; x) P7 H/ [( K

4 j- p; M) A5 l- c  n7 V在nginx站点配置中加入下面代码:. J0 O7 _: A$ u/ D3 l

, M3 }7 b  \$ f$ J) V8 i. F0 Y subs_filter_types text/css text/xml application/xhtml+xml application/xml;, I3 s  J* \) ^* }' y8 v: L% g
$ n% x4 w, I  B; e7 Q) Q7 N* l8 S
重启nginx就解决了% Z. E2 x7 F, A6 G/ L
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-3-8 15:25 , Processed in 0.070816 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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