找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14472|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
$ b# q1 g" I# I
/ t+ R0 g" Y. m一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
( p5 H/ R& Q- r; `% R' M! k$ h8 D+ ]3 a$ g* E
打开ngx_http_substitutions_filter_module的github看到:
) N+ Q5 ^' \9 m2 [( [
6 N! H) F- g1 x% J, R3 B( }( \  H  l
subs_filter_types; K  Y% X, x8 f1 @
syntax: *subs_filter_types mime-type [mime-types] *" i# ~6 k+ }: f% L

/ L# `( ~9 f! kdefault: *subs_filter_types text/html*: B- T* b, w: A! V# L' v# x1 s1 G

: F4 Z0 o' F# ?0 }9 Acontext: *http, server, location*0 w* e# n% H" Y7 S, X

2 y" S4 U4 @) g) Z4 |*subs_filter_types* is used to specify which content types should be; L0 T( s2 _! j( `% D+ U+ G1 H
checked for *subs_filter*. The default is only *text/html*.
* N, z3 T+ }, J8 ~* b) B+ r5 X) Y, A1 j( |" p' T
This module just works with plain text. If the response is compressed,
. S' B, H) t! \ it can’t uncompress the response and will ignore this response. This9 e( U( C) ?8 N; c1 c* D6 p3 ~
module can be compatible with gzip filter module. But it will not work
$ F8 x  \9 h* Z- T# b" y3 O with proxy compressed response. You can disable the compressed response: Z8 {$ U' ?. p/ N8 }! u" }) R
like this:
2 ~: W2 G0 v; X, o& p. g% R1 h: r: i
" P8 u' B# f# n4 l8 Q6 c8 K" Fproxy_set_header Accept-Encoding “”;
+ ~& q9 X/ z( j# `7 b9 V7 \

% ~$ q; u* Q' y, I+ e. R+ X0 d好吧,原来是没指定替换类型,默认只替换html. Y8 H* a  n% y/ w* o0 ]

- H0 p. P" P$ v! f7 W  z1 |在nginx站点配置中加入下面代码:. K) d6 z' j; Y+ M! C& D# c1 ^* {

& n  q5 D1 k9 b5 X subs_filter_types text/css text/xml application/xhtml+xml application/xml;5 ~! V' h- H! f; w/ S
1 _  z) Y$ _) C# \! `
重启nginx就解决了# {, ?4 ^" M  B: ^# f: c- B
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-3-26 06:40 , Processed in 0.065146 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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