找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14618|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
  p: ~  Z* R7 y! J$ @) ?
# v5 i1 O, \( y一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)  U9 O# I4 A) H3 e

% G+ x0 H7 m% B( q' S打开ngx_http_substitutions_filter_module的github看到:
& r4 o) F/ Y1 e0 [) F1 `: G
7 P6 ?4 D' [0 i/ f4 I
subs_filter_types1 e8 w) q8 X+ q. ~7 D8 C
syntax: *subs_filter_types mime-type [mime-types] *$ w5 p! v6 Q- f9 o# K

: I, k, N. a- W6 P% Q4 Odefault: *subs_filter_types text/html*
' l8 ?" D3 \/ j* f$ ~6 z' d9 R/ T0 ?, J, @! O+ W
context: *http, server, location*
4 Q9 z. v  q7 }) _9 Q8 o- {6 k8 x& H- T1 k# {- C5 n
*subs_filter_types* is used to specify which content types should be9 Y* i' z0 V+ p% C' V0 s# ^
checked for *subs_filter*. The default is only *text/html*.' k6 |- L+ D3 u; g; Y* }9 L3 [

, I+ M7 y. U+ c; X1 R) Q( K% AThis module just works with plain text. If the response is compressed,: o$ m/ H* V0 b& L
it can’t uncompress the response and will ignore this response. This! T7 k% n; S" z" ]% ]' R' S
module can be compatible with gzip filter module. But it will not work
- ]! \! z: |6 J  u$ C' j$ G with proxy compressed response. You can disable the compressed response; \2 ?/ S- @1 ?. O1 V0 e- A
like this:9 n* L& U0 B: Y  U& V8 B! m* O

$ C: P2 k0 y% v3 S4 U7 _6 z) T4 kproxy_set_header Accept-Encoding “”;
' s1 C! q: X% C8 Z3 s

3 f+ a; I# h! }3 {) N+ D  y好吧,原来是没指定替换类型,默认只替换html
, e1 W; c* a2 N' t* `# H" U" U, V2 |& W
在nginx站点配置中加入下面代码:+ \5 s% Y2 ?+ Z
- Z' @4 }  B) f, t; ]% O0 Q: I
subs_filter_types text/css text/xml application/xhtml+xml application/xml;5 ~# w0 B! F: b; _, s" j
) u7 x! C. E1 n. x- [
重启nginx就解决了
$ r$ i$ h$ |/ w
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-4-4 20:08 , Processed in 0.061650 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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