找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15327|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
# c; B( {3 k+ r5 r, ^  x* ]. \5 W# C( [' _" s( \" [  d2 P! R$ Z& K
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
& Y& Z) O) s" v( T: z4 P
6 f: z, _/ C0 ]$ w9 C打开ngx_http_substitutions_filter_module的github看到:" z. ~, y7 ]6 E" o0 u+ u( q

# u# k" |) K4 [" e7 p  u7 D9 ^1 M
subs_filter_types
3 ~5 B' g0 X3 B# Q" F8 T syntax: *subs_filter_types mime-type [mime-types] *" M+ }/ O/ G4 X  d  f

( {# b' E! j2 }1 h* N1 Cdefault: *subs_filter_types text/html*
) T7 `8 ?. P; T0 [( v; A! s% |1 `
. a' Y0 h4 k1 w4 S& k9 y' Vcontext: *http, server, location*+ I' G8 @+ a7 m: j1 [( O
3 _% c2 J( M5 V4 i$ ~8 Z
*subs_filter_types* is used to specify which content types should be0 Z: A- o* Q" g: u. j4 s2 C
checked for *subs_filter*. The default is only *text/html*.
# v( |8 l% \- k' v6 `5 n9 H# W  J& e: ^7 p
This module just works with plain text. If the response is compressed,) t) o: [# G4 E- C- \+ b
it can’t uncompress the response and will ignore this response. This: y, u1 l3 z3 b1 E" ^% Z; ?
module can be compatible with gzip filter module. But it will not work( ?2 D( H5 g0 _6 s: a
with proxy compressed response. You can disable the compressed response* ~" J  w$ o1 \; h; [- v
like this:$ v1 t6 Q- ~* y- j: \4 q
, h  j% H8 U: y* ]! [& r- \
proxy_set_header Accept-Encoding “”;
- z6 i# Q* D- B1 Y- I+ b

8 \! V5 g# }( E& t1 ^( b$ L0 D好吧,原来是没指定替换类型,默认只替换html
  ]( E3 a. ~, l2 a
& [$ n+ p/ O7 Y2 P( M1 v在nginx站点配置中加入下面代码:; _  C! H7 ~. A8 n" S0 t

6 }' N8 ]) f8 d5 A+ t" r: B: Q: I subs_filter_types text/css text/xml application/xhtml+xml application/xml;
6 l) u; K; J+ c
9 t! C. E* w( J; ` 重启nginx就解决了5 o2 x8 i: y/ @, h1 q  R' J. u
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-6-15 17:17 , Processed in 0.051278 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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