找回密码
 立即注册
查看: 10252|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。" u6 z$ T7 ~9 c- d" w

1 z+ S$ e6 m; a/ H一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)6 t$ J/ h$ P* G+ @! T" b  ?

1 u+ T7 e. q) _- V: @3 D0 `打开ngx_http_substitutions_filter_module的github看到:6 u* l9 m# @/ p2 g- S/ i# a

6 x4 g' W5 O. i6 M' t
subs_filter_types% C/ f5 K$ j9 t4 c8 E$ K, M5 [
syntax: *subs_filter_types mime-type [mime-types] *
$ X# T) C" ~: B+ H; J& g
# o; l! }& i6 Jdefault: *subs_filter_types text/html*/ i1 c5 a+ _7 I( ]8 [

/ U7 @+ G' s- r& m; pcontext: *http, server, location*
. i0 X$ o5 _1 [1 Y( u8 Q1 D: }; Q. ~% K, E: i
*subs_filter_types* is used to specify which content types should be
4 ^, w6 `9 T( n- r" n$ @ checked for *subs_filter*. The default is only *text/html*.. q: W5 B8 d1 w

$ I/ f0 G" {( HThis module just works with plain text. If the response is compressed,& v6 T. e! T- S+ r# s" X
it can’t uncompress the response and will ignore this response. This
/ f% r% s) u% @* k0 J+ U( M$ s1 K5 ~ module can be compatible with gzip filter module. But it will not work) K! |' a6 |# B/ }$ G
with proxy compressed response. You can disable the compressed response
: R$ d3 Y7 \  q3 O+ N0 T/ [ like this:
8 S* L" l7 D1 r# Y1 f3 b! W" T4 |+ s( h* `; ^9 I
proxy_set_header Accept-Encoding “”;

- w( m4 A/ @# t0 L
) ?( ]  \/ K; B  u* ~好吧,原来是没指定替换类型,默认只替换html
6 b" U; U& o, C% P) f) _! p7 J% I) M" v' ^$ T3 L- _, }0 ?* w
在nginx站点配置中加入下面代码:
: Z% C2 M8 i4 o- y- b. L6 P  H( ]' l' k) z/ t
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
' n$ W) R6 j% R  a; C! n3 |  v. m, V
重启nginx就解决了& m! [6 h* G. D( D9 Q& N
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-5-5 02:01 , Processed in 0.062917 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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