找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15139|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。. r& ~) Y' O- _& o( m* s3 r

8 U8 ?  e$ V3 b* H$ V/ A8 Y一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
2 }; j2 G; _& |, ~
9 Z3 X# E5 x  Y( H) G7 I打开ngx_http_substitutions_filter_module的github看到:
+ U5 O1 [, A( n+ z5 H. g+ M; Q: Z8 I! D
subs_filter_types
0 V0 G6 ^& Q. @/ u3 E; j  R: b syntax: *subs_filter_types mime-type [mime-types] *% O( b" E# K3 p  |5 K
& l; E; r/ s# a: k
default: *subs_filter_types text/html*' ~/ R- O# ?5 m' w3 m% j( k! c

: I+ l0 o" F1 M5 [1 icontext: *http, server, location*$ Z) Z, O: U# U8 _/ B: S. Z5 q
* \, c/ I( y8 z: @7 d
*subs_filter_types* is used to specify which content types should be
1 N$ L  _& c: f* Z4 } checked for *subs_filter*. The default is only *text/html*.0 I  F2 z* d# j# ]4 y& z
, n* l8 I  ^: X5 q3 B
This module just works with plain text. If the response is compressed,9 _0 \& p% x5 X" x7 \- h# e2 t
it can’t uncompress the response and will ignore this response. This
  O) _3 X, B2 z: I/ n2 G, f+ n module can be compatible with gzip filter module. But it will not work( C. l. g/ T; X0 B$ q: a
with proxy compressed response. You can disable the compressed response! z% U8 T$ s0 g
like this:
9 K) z; D4 ], }1 _
; B: F7 z* B5 Q# Bproxy_set_header Accept-Encoding “”;
  z9 v" i3 ]3 X2 l
" z! I: b. U! O
好吧,原来是没指定替换类型,默认只替换html
  f; ]- ]" s, [& `2 ]2 S, z. i- g  o+ w  w& P+ u# a
在nginx站点配置中加入下面代码:
( V6 ?& F  K3 y& X& ]4 ]' t/ q4 }, J, E  H
subs_filter_types text/css text/xml application/xhtml+xml application/xml;9 G5 c' w$ @, _

" t+ w0 D/ g5 X2 S0 W; e 重启nginx就解决了# U8 j( P/ C5 w6 }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-5-27 05:25 , Processed in 0.085260 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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