找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16466|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
, {! R4 K* V7 I' t4 D, u/ F% \) h6 H: P
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
# M" X$ Q# |" c2 N! {- r
$ e0 h4 v5 `$ X) s$ l8 _- O8 K打开ngx_http_substitutions_filter_module的github看到:3 i' v! z3 u6 y
/ [, m3 l5 {$ d! c( g* K0 b
subs_filter_types
+ }( r; F1 y- b/ v+ R syntax: *subs_filter_types mime-type [mime-types] *
* K! w! {, b' w1 p) \% s; E5 Y6 X( f. q
default: *subs_filter_types text/html*5 q( |% P) p3 X, Q

2 h8 v+ A9 F' U; n8 Icontext: *http, server, location*, y* @" V# m; n/ ^' k2 o' K# X3 A$ }

6 L' R6 ^% P/ ]' H) }- u*subs_filter_types* is used to specify which content types should be
3 _7 J) C. a: j; ^5 ` checked for *subs_filter*. The default is only *text/html*./ Y& t. ^" [0 J& n# P
2 }7 ^; d' e4 v; J
This module just works with plain text. If the response is compressed,: \0 G7 Z/ q$ [' ~2 V% a; M
it can’t uncompress the response and will ignore this response. This
* e: j9 n) J' X0 A% F/ p module can be compatible with gzip filter module. But it will not work
, i6 p% u0 B' y5 H; a4 [' R% W with proxy compressed response. You can disable the compressed response
  z: y: u( e* K. F like this:2 }6 t$ z/ |2 D# m
; O4 X& B( V5 @% K- y
proxy_set_header Accept-Encoding “”;
* G) j: q0 F5 ^: [  ^

/ x. I/ m3 d2 D6 E/ f6 ^5 {9 @) F& U好吧,原来是没指定替换类型,默认只替换html( [% S+ O! n' b  `) _: V
! {* D5 h" T" M- N, V5 V& ]$ d+ t
在nginx站点配置中加入下面代码:
" Y5 G. a1 u5 E' e! r
/ Z# B$ B1 H$ ] subs_filter_types text/css text/xml application/xhtml+xml application/xml;
* l! S5 R, Z8 z0 ^
. j* K' m/ q6 R  j5 l1 Z 重启nginx就解决了
; H2 o6 w5 G# J; K
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-10-24 17:47 , Processed in 0.035518 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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