找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16297|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。+ u& T6 M# W0 W$ V. z) ?7 U: O4 r

7 @! Z' z$ h' _) J1 L一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
; F: j# z: W' h" n% A3 V" v; m6 W. E1 j9 n
打开ngx_http_substitutions_filter_module的github看到:
  [6 H0 x( m1 ~+ e; R
4 U, W& }# B# V. O
subs_filter_types; a7 V2 H/ f9 o) `
syntax: *subs_filter_types mime-type [mime-types] *
  n! Z+ e  p- |9 m: _. y1 f' _* d
4 i8 g4 H. b8 j) E1 I7 \% E  s4 Idefault: *subs_filter_types text/html*1 K8 {) d  d8 a* J
6 h7 L, |+ h2 m4 V' X* C! H
context: *http, server, location*  R/ `2 t! D4 i1 K" ]
0 g% ~3 ?0 ^% T6 M0 X9 c
*subs_filter_types* is used to specify which content types should be6 w: |7 J- O( z" O
checked for *subs_filter*. The default is only *text/html*.
+ z2 t* B' k6 u: I' ?  v% T# |' w% U4 J0 }: A
This module just works with plain text. If the response is compressed,
( j; R0 h1 O; j3 d it can’t uncompress the response and will ignore this response. This
: z8 o5 I. w. G9 |4 r$ v8 p& U module can be compatible with gzip filter module. But it will not work* n: x: k* n  c) g9 Y( A0 |. b
with proxy compressed response. You can disable the compressed response
4 G$ g1 E0 T" g% n$ {  u1 y like this:
  }2 V8 F3 m( g
+ D: O- ~( R, Z4 X  Hproxy_set_header Accept-Encoding “”;
" i+ s. Z* F9 u' Q

  R7 ^: d: b9 y3 `( r) ?: C! o好吧,原来是没指定替换类型,默认只替换html* e7 C* ?  d( A& [) X  S+ P: q# e  o
. c- p1 p! p9 P9 L2 y
在nginx站点配置中加入下面代码:
( f5 |7 m% Y* |9 _" p. z1 F$ x( X& I) P% I; d% w
subs_filter_types text/css text/xml application/xhtml+xml application/xml;& z4 C* y/ H0 Q( _5 C+ V" p: `
$ N2 w8 @% x$ M( P+ P" ]
重启nginx就解决了' r6 W3 }; C  ]4 f3 c) B4 a
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-9-29 21:33 , Processed in 0.055696 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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