找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15770|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。( q$ g0 ?7 X. k) S
8 ~1 u- t/ C) ?" A. k5 T/ K
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)/ G2 }6 T3 ^: x8 M- h4 h( j
! ^6 c4 e* L7 w
打开ngx_http_substitutions_filter_module的github看到:, |) c# E( c1 @4 p( u; X8 [

, U7 p: V5 M  b( Q
subs_filter_types
' f+ ~; [/ w. ^; d3 x( q) H syntax: *subs_filter_types mime-type [mime-types] *  I5 {0 P5 h$ w- a. d; ]9 g
  m* C7 K" z' C7 |2 M
default: *subs_filter_types text/html*& x2 t% g- R2 T5 k
1 M4 J2 ?& r" q0 }& `( u- n) W' g) P. S
context: *http, server, location*
) h4 R6 x$ j" r2 v; Z' @: [5 K: r- r! u/ d8 H
*subs_filter_types* is used to specify which content types should be
% r' `( w/ Y. h  l( Y% ~3 K4 |( q checked for *subs_filter*. The default is only *text/html*.
2 z6 a' k) a' t, N) L, U6 ^% M
- m- P9 J1 R5 d0 uThis module just works with plain text. If the response is compressed,
3 C. c4 r. ^1 }2 ]3 k. V% T2 k$ E it can’t uncompress the response and will ignore this response. This
6 h* C, h, n% w. ^- M module can be compatible with gzip filter module. But it will not work7 r7 `  I7 n+ _
with proxy compressed response. You can disable the compressed response/ C0 \/ Y( P1 c7 q5 b
like this:1 ]7 |$ Z5 ?0 Y9 l/ j2 k! q1 g$ O

* h/ v& c7 c2 @; d' T6 Kproxy_set_header Accept-Encoding “”;

1 r# G0 e, t6 u; A! l
# L; ?8 {+ f( k! U9 ~. n$ b6 E好吧,原来是没指定替换类型,默认只替换html5 z6 p2 m4 G' _* N

+ l% B0 `0 q. l/ g5 P1 n# V在nginx站点配置中加入下面代码:
% N7 z/ _" t2 G1 W  _. u( `% j) H3 y: D( `
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
5 x  Q* A9 q7 i0 t/ h# c6 t& z
, J) A' k* c' x4 ] 重启nginx就解决了) b" S! R! _& l/ h$ Z
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-8-6 02:46 , Processed in 0.070399 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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