大叔 发表于 2013-6-2 19:06:53

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

反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。

一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)

打开ngx_http_substitutions_filter_module的github看到:

subs_filter_types
syntax: *subs_filter_types mime-type *

default: *subs_filter_types text/html*

context: *http, server, location*

*subs_filter_types* is used to specify which content types should be
checked for *subs_filter*. The default is only *text/html*.

This module just works with plain text. If the response is compressed,
it can’t uncompress the response and will ignore this response. This
module can be compatible with gzip filter module. But it will not work
with proxy compressed response. You can disable the compressed response
like this:

proxy_set_header Accept-Encoding “”;

好吧,原来是没指定替换类型,默认只替换html

在nginx站点配置中加入下面代码:

subs_filter_types text/css text/xml application/xhtml+xml application/xml;

重启nginx就解决了
页: [1]
查看完整版本: 解决nginx反代Discuz论坛登录跳回源站的问题