找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15119|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。" Q8 m0 x& x8 ?  B& ?2 x
* [& ?, T. S8 z
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)$ i! `( ^+ N7 |) o% t
% T' a4 n% S* M( w& a' ^( H( y
打开ngx_http_substitutions_filter_module的github看到:  m$ P$ s, ?) a; m
% }- u0 d; @. y
subs_filter_types* U" ]& K' m5 E% P5 `% q
syntax: *subs_filter_types mime-type [mime-types] *
, A( T: J. ?" I4 S' g3 g8 o' C5 r8 O+ q" ~
default: *subs_filter_types text/html*. u0 S) \; Z# ?6 Q/ L2 ~8 _

7 U% P" S  p) J6 _& v  mcontext: *http, server, location*
9 U3 d8 L0 @) \8 \
& P  v" G* k. h0 D/ I5 I! u" r* m*subs_filter_types* is used to specify which content types should be4 g9 F( h& s) D# W
checked for *subs_filter*. The default is only *text/html*.) Z7 t! m' ]. b, g' I2 U7 Z$ o

' U: J  \5 s( h. B" w1 GThis module just works with plain text. If the response is compressed,
: m, J% e' `5 U  ~6 O5 V it can’t uncompress the response and will ignore this response. This0 f- t+ u, z( D' o0 L* K
module can be compatible with gzip filter module. But it will not work
1 r3 J- @: P4 o' M+ A) t0 B with proxy compressed response. You can disable the compressed response
/ |' Z7 D7 p8 q( Z6 M like this:
1 t/ L( N" m0 g- |$ w, `: B% e$ {, ?" x9 u! m
proxy_set_header Accept-Encoding “”;
7 x/ X8 J3 e3 }+ f2 n5 b

7 @: A1 _0 Z- s+ B7 H6 j好吧,原来是没指定替换类型,默认只替换html5 K/ X) ~; M* X; ?* t

/ }. P& n: K; U# ]1 x在nginx站点配置中加入下面代码:
3 R- I) u) a$ k$ U" L3 ^/ t( w- m4 O! y. G
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
9 N& U1 a# Y- Y1 b8 C; m
5 ?# Z. ~3 \" k0 [ 重启nginx就解决了
; v! ?2 T9 @  ~+ w# ?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-5-25 11:04 , Processed in 0.061583 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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