找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15581|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。9 a$ s7 E3 J% x( S& }6 Z' S( H  L

: C% T3 O" A+ Q( ^& v% W一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
7 m0 V. b' ?0 [# w& K" [" L" t+ _7 S* F4 J" L& n5 g- p) F
打开ngx_http_substitutions_filter_module的github看到:
& P# C9 f( E5 q# y/ j2 B( S; u; @9 Q2 ~
8 o+ k# S% M! ^' A0 f
subs_filter_types
, @, W5 B1 U) h9 A4 X9 i8 z syntax: *subs_filter_types mime-type [mime-types] *6 y! Q5 a: r. A5 l; }% B( O' s

' O& u3 R8 V' |2 S" q( Vdefault: *subs_filter_types text/html*
2 q$ g) n* j1 H! n
$ F/ |" u% R. f' P* L. p( Dcontext: *http, server, location*0 `+ G/ f/ o% Y+ F$ H2 g

' f2 y; q# Y4 W7 A( Z*subs_filter_types* is used to specify which content types should be
" E# R6 n. u$ D8 z checked for *subs_filter*. The default is only *text/html*.
8 a, m$ o& \; X7 `) y0 C/ @" G2 y' j2 l! C) C0 F7 l6 q! _/ H9 Q
This module just works with plain text. If the response is compressed,2 T+ z5 n  [- |3 ^8 L6 {' I
it can’t uncompress the response and will ignore this response. This+ u2 ^9 s, V2 M4 O# v; F' ^8 a
module can be compatible with gzip filter module. But it will not work* C+ E* o9 ~$ g. C5 \' q
with proxy compressed response. You can disable the compressed response8 I7 S# h, E1 k/ j, u' s! b( K
like this:
( D4 V* O8 \, V' e0 W) Z! k% S1 _9 B
# I% Y! j( A/ ]/ M6 [. d* Kproxy_set_header Accept-Encoding “”;

1 k7 m/ D8 z. U8 u: ?6 ], x6 z% E- a" U6 r, V: B2 Z
好吧,原来是没指定替换类型,默认只替换html. E; m; M* Z2 H  _8 u( y: W! S
: c; |9 _" ?: Y5 ^! X- E
在nginx站点配置中加入下面代码:
2 J# Z# y4 P) I' X0 i5 \0 g2 \1 [: F  q- t7 a, \
subs_filter_types text/css text/xml application/xhtml+xml application/xml;  t$ \# x7 Z) ~& X3 i, H1 R

( r: I" @! K7 @9 e' @; D/ J( @; j9 j  O 重启nginx就解决了7 S2 k7 |+ g7 i% q
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-7-11 17:27 , Processed in 0.065127 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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