找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16652|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
# r2 c( V5 @5 }
6 G+ b4 ]* G4 M1 e" H) l一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)+ Y/ P6 Z# n0 G: m2 ^* j: Y
' o. K' ?* m4 C8 w! Z% ]3 I
打开ngx_http_substitutions_filter_module的github看到:/ o8 B% @. e: A* ]' x

, Y4 |, E. i' J
subs_filter_types
5 p5 B/ C1 L2 \9 {! d" k/ @. R syntax: *subs_filter_types mime-type [mime-types] *
6 E0 W7 [* ]! w- R5 k4 n2 X3 ?6 _" x5 E  e) F  V* _( l
default: *subs_filter_types text/html*
1 A* {) s- N* S& q+ n/ P1 D# M5 A2 ~, G1 w7 V, H5 x  z
context: *http, server, location*
" O* n& @- p% J4 w, t; ~; d: v9 Q9 L
*subs_filter_types* is used to specify which content types should be7 c( U6 Q3 D; c# ~! W* Q( p* R
checked for *subs_filter*. The default is only *text/html*.
# D3 M/ M4 R! |3 f% ?+ ?! |  }+ d- ?! u8 {/ W* \2 P/ O- e
This module just works with plain text. If the response is compressed,6 g- I. e2 s" X) m# K7 L
it can’t uncompress the response and will ignore this response. This
; P+ i1 G" Z/ Y& m( I module can be compatible with gzip filter module. But it will not work
) H" T, U! p, q) T( [: r with proxy compressed response. You can disable the compressed response- r# @( S' M2 _2 Q9 A( T' {
like this:
% {8 p3 q/ `7 E, [7 ^: o. w# c2 N9 O6 t! ~
proxy_set_header Accept-Encoding “”;

$ X9 M& o1 m1 x  f9 U& n
! w8 `" K% V4 k1 W, V- ]好吧,原来是没指定替换类型,默认只替换html
5 y- Q8 M6 T5 ?' a( a4 n( i6 [6 \1 i' I5 \$ ^
在nginx站点配置中加入下面代码:
8 s# T' ]& v+ V: E3 i( [. S( @' B; b7 J2 g) G3 f$ ]: B8 o( D: O3 T' N
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
( d2 X7 E/ f8 }2 v7 e( E* C  ]4 K+ _1 Q7 d- [4 t+ N, @
重启nginx就解决了
7 ?! x# T% ]& h; i% k! t( r
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-11-21 12:58 , Processed in 0.079154 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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