找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14943|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
# s7 p9 T$ @9 R! ]1 t% l6 }9 J
7 @- q, c# J; o1 S- X, d! ?) T3 d一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
4 R9 M) |# E" Z5 v, O0 d0 m8 |3 g* u3 _( ]& {
打开ngx_http_substitutions_filter_module的github看到:
5 g- c2 {. m& Z$ X) a8 E# G1 F% @; \( J, V. I
subs_filter_types
$ Q* [& }: D  h  E1 E& U syntax: *subs_filter_types mime-type [mime-types] *" u6 R+ @6 ?, r

0 U2 M: _" z* y+ g* X+ ]; K! ydefault: *subs_filter_types text/html*- R( f6 }9 b) f2 G
6 f1 ~6 @( w6 @& L; M
context: *http, server, location*
( z; e  n' ~) q3 \9 y4 P! c
" l, r: @3 w8 N3 o& G*subs_filter_types* is used to specify which content types should be
7 q9 T+ K" L$ p' x! p# ? checked for *subs_filter*. The default is only *text/html*.! Y2 b: r: h% g; q3 I2 V2 O$ C# `
* l0 P& k8 ~, ]: S  T
This module just works with plain text. If the response is compressed,
, |$ P% h# ^* \$ T# g+ z it can’t uncompress the response and will ignore this response. This7 c- V9 A2 \4 {8 K
module can be compatible with gzip filter module. But it will not work1 M2 _2 Y# G7 h6 d; N
with proxy compressed response. You can disable the compressed response
- O$ J* @4 }4 z/ w like this:
  F( b- v8 ~7 I* a; c0 t. N* {+ x) K" w
proxy_set_header Accept-Encoding “”;
. `4 V6 x+ C7 _! ~& g
" m0 N* u( Q+ f$ y9 X# A
好吧,原来是没指定替换类型,默认只替换html
! L$ B  i5 l& ?! s% V) x' Y  i
9 g, |. A% {$ j( b# _7 i在nginx站点配置中加入下面代码:7 F9 g( ~8 ?( }2 B
& L; K/ Q2 L% F
subs_filter_types text/css text/xml application/xhtml+xml application/xml;. Q9 E; H1 d1 ?

4 c2 m- k) }! w& [7 v 重启nginx就解决了
* ?8 h! B& I! C' t/ R( M- w
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-5-7 01:28 , Processed in 0.088182 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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