找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15769|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。2 l9 r% v% x. e: W

1 O0 g1 O) n) F  {! Q一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
+ r$ g1 ~+ D( X# J, a5 c/ v
2 k/ S8 ]4 }) F6 T* o# T4 }打开ngx_http_substitutions_filter_module的github看到:* Y) O; l8 z; D+ Z/ ~

5 [0 ]6 f3 @6 x% A6 r
subs_filter_types0 E: k7 [7 y- W: j
syntax: *subs_filter_types mime-type [mime-types] *5 t/ r- s( B* ]9 ?0 V
# M& A9 G2 t  H$ c3 O
default: *subs_filter_types text/html*
5 t) c1 y* e. ~/ y5 b# I- \9 ^2 t- Q5 h) x  M8 Q4 M* }
context: *http, server, location*2 @2 ?8 e5 ^2 R+ p1 L* ~( p
1 E2 K7 i, s# r1 Q9 V' {
*subs_filter_types* is used to specify which content types should be4 v  p8 L+ n8 ?4 w7 L
checked for *subs_filter*. The default is only *text/html*.
7 G  N+ J5 A2 w8 b" Q$ q" ^. [/ e3 t" ^  X' H9 h9 {/ b
This module just works with plain text. If the response is compressed,
. d$ J7 Y8 X0 x5 J& J1 B it can’t uncompress the response and will ignore this response. This
* \7 y9 `$ v8 o) E# X module can be compatible with gzip filter module. But it will not work' h9 L/ Q/ ?! a: z
with proxy compressed response. You can disable the compressed response
+ K4 `% I% S5 G4 J1 U$ u like this:
" b; z5 q& P# E* W5 `/ r' R# J( K# J6 u. Q, |$ n: n2 j4 E
proxy_set_header Accept-Encoding “”;

; r  }6 |; m7 y; y7 u, G. l7 H: T6 C, w4 ^
好吧,原来是没指定替换类型,默认只替换html1 c1 [3 a( h$ E/ m/ G- E# s/ p5 g3 v

# `  z0 i1 @& O: G5 f6 R) n5 [在nginx站点配置中加入下面代码:
" }* c9 n: [4 m, r9 a$ \6 N% F6 a; Y9 l# \% V7 ]- o* C
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
4 l0 e) y! b+ |& E
5 m! r  s6 _/ K' n 重启nginx就解决了; j* I  v: k+ F3 s, U$ {
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-8-6 02:45 , Processed in 0.058302 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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