找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16239|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
7 k, G. x# a% i" u+ s" Z' w  ^3 y' i; g, b
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)) O1 v: A* v/ x8 H1 K/ O4 f6 a
. ~4 ^8 ^+ ~8 X: C+ [5 m1 u
打开ngx_http_substitutions_filter_module的github看到:7 q$ A+ i# ^8 g' b
, ]8 ]- I: s- X! j
subs_filter_types
' c. E; ]# o& Z syntax: *subs_filter_types mime-type [mime-types] *, d' l. |7 N6 m7 g- ?7 k4 ~3 U

5 q* s" F7 A3 q9 Z+ kdefault: *subs_filter_types text/html*  a- D' z. N, h' f+ e* `

) r/ H: C4 I5 l6 x- pcontext: *http, server, location*
8 j3 l0 i7 y. Q+ o% O# L0 g4 H
8 v$ Z# D# D0 {5 c. m% b9 P*subs_filter_types* is used to specify which content types should be; ]/ i6 J: X9 z+ T2 u# k
checked for *subs_filter*. The default is only *text/html*.1 A* Y/ G) m% r

% I; X2 Q' D! b' \) D, }3 J  fThis module just works with plain text. If the response is compressed,4 R# R; L; |( \
it can’t uncompress the response and will ignore this response. This
& Y/ S: u) h/ p, v5 i6 E# R; V' _7 y module can be compatible with gzip filter module. But it will not work7 u3 Q! r# d; J, ]$ e# _
with proxy compressed response. You can disable the compressed response! Q' R1 {6 U* J- p
like this:: V. A  ^: \' N) w+ L7 a& l; Q
1 O, T+ z8 n$ f% I$ _$ H6 q: z
proxy_set_header Accept-Encoding “”;

* U$ D" q! d7 T  C% ]; i
1 x% C! a# R7 d6 n8 P5 z* V好吧,原来是没指定替换类型,默认只替换html
8 z, z$ Z3 P0 W7 O# y" S: N% w
" Y6 }' h8 F4 p- _2 M1 L" I% ]在nginx站点配置中加入下面代码:8 E- Z3 y/ n; x& U9 W0 ~

0 n3 o) q8 e7 L% B5 ~3 o subs_filter_types text/css text/xml application/xhtml+xml application/xml;
2 T& r% u. c$ ?( o  j' k( N; a7 b# _+ k
重启nginx就解决了
0 [6 |% V0 H$ q# ]- u
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-9-22 06:38 , Processed in 0.075974 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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