找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16534|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
3 D! [; N2 ~# M
# L* k( w" E7 H4 m% I# b; n$ S一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
, K6 ?! u* F( q6 B! Q
5 Q1 `: b2 q0 l6 B; A- ~( o% ]打开ngx_http_substitutions_filter_module的github看到:: {8 {9 t0 v6 l, R0 M
# M! F& N; N. K' E. @. }
subs_filter_types% I, o5 W1 Q0 l% k# |1 O
syntax: *subs_filter_types mime-type [mime-types] *. Z. r; s& T" R2 W5 E+ u  W

$ X5 ?0 `# j4 Q# \, c0 R6 Qdefault: *subs_filter_types text/html** Q. V3 y3 h/ l. p9 J* c

/ ?9 m8 W" y4 O; X+ ]) Dcontext: *http, server, location*
: I) d( \8 k8 n/ J. U" \+ l4 D2 G0 d+ X
*subs_filter_types* is used to specify which content types should be
  U7 o& o& n; [) Z: v, e$ Q* x checked for *subs_filter*. The default is only *text/html*.. p; O1 a6 `/ B

* f" J; G7 h% B2 g& Z& _This module just works with plain text. If the response is compressed,! a. y+ R: S( D  {
it can’t uncompress the response and will ignore this response. This% ]" f1 Y- {4 o. ]4 j+ j
module can be compatible with gzip filter module. But it will not work
7 t/ B2 e. Z/ h* Y" q% ] with proxy compressed response. You can disable the compressed response, P9 Q" ~3 ~& d) T. u7 o
like this:
' G: S! i& s) @/ f7 h/ T# O
6 x7 [; Q& X: M* I0 _proxy_set_header Accept-Encoding “”;
. J. w; k" o7 E

- E# o- p: p) J; b/ M好吧,原来是没指定替换类型,默认只替换html
  P7 A9 n% ~0 ]; V
' A; C$ Z8 r/ ]' W* f在nginx站点配置中加入下面代码:
2 x# E8 u: M. W( Y4 ^( R( ]- |5 r" o' [( l
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
3 s2 i4 R9 ^/ c9 t4 t
" x" ^! g. R/ ]' @. ]' q 重启nginx就解决了8 {) u* @3 ]) G6 J, c
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-11-1 11:45 , Processed in 0.068823 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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