找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16615|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
0 B9 U0 z: R5 R9 D* [) M$ T0 T
) Z1 Z/ M! q' b  @! J& u% y/ U一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)9 J  Y8 S% l$ C" e
% ]# ^* A. d7 y2 o4 B/ u  z
打开ngx_http_substitutions_filter_module的github看到:
, k6 N; K! _6 `$ V7 W% P7 ^7 [: v" K6 L6 G0 E$ b. G( M
subs_filter_types5 M! a% i7 r# _/ v- K9 G' W
syntax: *subs_filter_types mime-type [mime-types] *) Z. ^+ w) p3 b" ]+ s: W  X# B

$ t0 C& l$ [! K. v4 Udefault: *subs_filter_types text/html*
3 \9 u  B5 j& k$ Z; o/ B! f6 N' l) x/ F
context: *http, server, location*
( ^" W; z2 u; t; {, ?) l: O: W
2 f( g' Q! m2 E) M, W*subs_filter_types* is used to specify which content types should be, R0 P( g  e0 }: D
checked for *subs_filter*. The default is only *text/html*.
( z) t! H+ }4 o
: o+ I! ?* g# Y& Z  e$ [' @' ~; LThis module just works with plain text. If the response is compressed,  R5 C% Q2 ^6 m
it can’t uncompress the response and will ignore this response. This, P5 Q  y/ t; U- I
module can be compatible with gzip filter module. But it will not work
8 U5 W# W$ Z8 {* q1 y1 Q with proxy compressed response. You can disable the compressed response
% _( T9 M4 a0 B# q. _: \# q like this:
' ]2 M, M( n1 j) J& J; h9 j
* l( |' Z) ]' b" X/ Rproxy_set_header Accept-Encoding “”;
' o" ]) C* ?  I& ]  K
! j9 ?0 ^0 ?4 G* K# _& {! B8 N
好吧,原来是没指定替换类型,默认只替换html
' J$ o9 N2 n# {2 [3 h- H% p% k8 q  b8 Q' N
在nginx站点配置中加入下面代码:6 A# C; n) D# ?& C9 f$ }
9 X" q0 I, |& V: [+ ]# m; V
subs_filter_types text/css text/xml application/xhtml+xml application/xml;$ W( k3 Y" u2 u! v4 u
' e) ~5 x$ Y: q$ h$ n
重启nginx就解决了
) s7 [& S* w, m0 F4 m2 C8 s
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-11-17 12:37 , Processed in 0.049376 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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