找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13638|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
$ D- o3 o! e3 Q& d0 N
9 {" \9 S: T7 @) u, U) k一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)  ?1 Q9 I8 X: d- j" a

/ U" j, q% {7 j& O' M  \; M- U打开ngx_http_substitutions_filter_module的github看到:* e7 p/ f/ Z8 L( @% m
  s3 p# q( g6 ^: x
subs_filter_types
& b, L3 Q) m2 t2 y* H( S- J syntax: *subs_filter_types mime-type [mime-types] *9 F$ x. E- \2 O* ]

' k9 ]+ G9 s8 ^  M; o( H% Zdefault: *subs_filter_types text/html*
- k* U* o& B) N4 A+ @
9 ^3 I- Y5 |9 \" _) N- Mcontext: *http, server, location*1 L0 N- r$ v8 q: D) l2 G

/ P( F  ~- z. A1 ]+ B*subs_filter_types* is used to specify which content types should be' f  H( g& D3 @  y. g% z1 E% \0 R
checked for *subs_filter*. The default is only *text/html*.2 X3 ?4 ?9 ~+ c) G3 P* j( `
" N2 n& A) w4 G  a( {2 f
This module just works with plain text. If the response is compressed,! h' N+ w+ H6 d- E
it can’t uncompress the response and will ignore this response. This
0 K8 {8 e; V4 f module can be compatible with gzip filter module. But it will not work* i. A7 U7 J. Q7 ]" v+ B( H
with proxy compressed response. You can disable the compressed response
, c  f8 k* l! K( ^* n6 X# ] like this:8 E8 p3 q1 ~# K- v2 ~
9 f* t6 \# ^) U+ E" J; r: D
proxy_set_header Accept-Encoding “”;

7 V2 y5 |3 u2 b: Z
" F1 y: t2 X! y) L好吧,原来是没指定替换类型,默认只替换html
' T; o% S2 c# x4 ?0 `8 X+ K+ b- e! w& y2 l2 Q, Z
在nginx站点配置中加入下面代码:
8 a& L2 h/ o; r" A, {
4 m* U: E/ r% b; I3 u! C" Q$ h subs_filter_types text/css text/xml application/xhtml+xml application/xml;' l' s- O3 Y0 V- q7 B

) Y) @" Q3 P! n 重启nginx就解决了+ G# j6 E9 a* j
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-16 22:38 , Processed in 0.067758 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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