找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14667|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。: V7 z5 k4 X4 T( `
3 ?5 I' M) o4 m; Z- \
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
+ Z3 R5 T. {* `
7 c+ h2 f* n) K8 ?; R: G" X) D/ E# S打开ngx_http_substitutions_filter_module的github看到:
- _" g' `, _$ i" T: T7 \4 v7 u, ~2 p" J0 l3 I
subs_filter_types
% x  H* W- K8 M, x4 {; t syntax: *subs_filter_types mime-type [mime-types] *
3 p6 Q0 t( y  n" `, c1 q1 f+ \5 p6 K1 N% S4 `2 K, E
default: *subs_filter_types text/html*# Q+ Z, X5 b! b" \7 ^# N" E

( ~5 x4 S0 z  i0 O, Econtext: *http, server, location*
" ^! |3 G, d( V: }
. {# I; n/ e3 t: q*subs_filter_types* is used to specify which content types should be  O# Z) |7 `8 q& D/ h
checked for *subs_filter*. The default is only *text/html*.
# {! G! i# ^% k* [
8 G, Y1 T% E: c, F. t2 I+ |" cThis module just works with plain text. If the response is compressed,( a( |8 V+ h0 ?* x1 d% F+ n) q
it can’t uncompress the response and will ignore this response. This# X: A* _; c1 b. F1 Q2 j
module can be compatible with gzip filter module. But it will not work
( g) H( ?$ R3 o! P1 v. D- \( Y3 C with proxy compressed response. You can disable the compressed response
# O1 x: A0 A; g$ o like this:
6 E. R; I* W; V7 w( e* V$ |6 T+ V2 _* k- N- i
proxy_set_header Accept-Encoding “”;

* k4 D$ o! m* i: N  p4 |" t0 [
好吧,原来是没指定替换类型,默认只替换html* `0 s6 [6 `' k# ^

- B  O7 d9 o3 s7 ?在nginx站点配置中加入下面代码:% R( b8 Z! {- M: ?# E  |
' p' x. h5 g6 j' I+ ?' @& e
subs_filter_types text/css text/xml application/xhtml+xml application/xml;
2 @5 |1 i; A& V; Z3 a1 p  Q6 n
$ F' r4 x2 R) _" z. t6 a 重启nginx就解决了  y8 l- i) P, C! K% W
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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