找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13987|回复: 0

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

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

  n. C: C' w1 l' N一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
  G/ d6 j. L: {7 c5 E. y' v  |7 a
打开ngx_http_substitutions_filter_module的github看到:/ y* N4 I. `/ f

. u" r) p. b+ W2 P1 `. M( R
subs_filter_types
2 R4 s/ |5 I0 e syntax: *subs_filter_types mime-type [mime-types] *
+ w. v& W3 N  a. u' \, h4 e3 P2 W1 D- c7 N2 c" j
default: *subs_filter_types text/html*
9 f0 _: ]+ S  T9 f! }; D; @  a( M7 C9 g' P1 k0 t
context: *http, server, location*
, B  n9 q% T) }7 ~( F/ m0 }* {7 S
*subs_filter_types* is used to specify which content types should be6 v+ |7 _6 \0 s: Y5 v' Q9 w3 t9 _) |1 O
checked for *subs_filter*. The default is only *text/html*.
: t7 d3 ?3 y6 q2 u9 P/ d" m0 m) p: F6 J4 V' v& c' K4 x( ^
This module just works with plain text. If the response is compressed,# J# _- m! S0 T8 k. v0 U
it can’t uncompress the response and will ignore this response. This
5 Q  l( l) }# B; S; S module can be compatible with gzip filter module. But it will not work
; Q+ A) d# @1 {, H8 t with proxy compressed response. You can disable the compressed response1 x9 k8 a( t: ]0 C3 ~
like this:. i) l- Q6 n5 Z+ E6 @! {

. D  p  q8 W( }2 g/ x7 v8 \# p2 i3 e; zproxy_set_header Accept-Encoding “”;

& o8 x7 G5 t" o2 a  S# ~# q" P4 T- y5 E" L
好吧,原来是没指定替换类型,默认只替换html
5 K- R: ~. C, P; S. S+ k! |! L- n1 u' B* s6 c' h
在nginx站点配置中加入下面代码:, _+ X! ~  v; N  V6 i$ p
. N* j, B6 J: k) M  W$ N
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
* E( H3 i& C6 \0 v4 [/ Z3 b% T3 H; A6 M0 Q
重启nginx就解决了
% E$ [  T" }& K# }+ o: K
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-2-4 20:17 , Processed in 0.064206 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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