找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15235|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。) \9 W- ]- x" u$ ]2 ]
2 V8 E. o5 z& l6 g$ d7 J+ J" N
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
+ O) z, w+ W+ w$ l% j* G( ^. u% H( i! ~9 Z  x8 P
打开ngx_http_substitutions_filter_module的github看到:7 }& `7 ^$ I. q4 s
5 i' {; q4 X- V) E: M
subs_filter_types# s9 s7 X: r. B* b
syntax: *subs_filter_types mime-type [mime-types] *6 f/ N  l+ d: |$ w& Z3 L5 k

9 K" |5 O' h/ ~+ H( }7 \default: *subs_filter_types text/html*
% G* v( q- P& W  \0 y8 p
( _6 b  e3 K' G% y8 bcontext: *http, server, location*0 Y5 Q7 \7 U9 }5 [, C) u
, m; }+ s  B/ }" _% y9 r
*subs_filter_types* is used to specify which content types should be* u4 Z1 o! {3 I0 S0 K, O7 W
checked for *subs_filter*. The default is only *text/html*.
1 A% ^* y! P. ~1 X% E
$ V2 p4 }: r) D# w+ [This module just works with plain text. If the response is compressed,
, d- R1 |- w; K it can’t uncompress the response and will ignore this response. This
0 E8 y# r: t$ V module can be compatible with gzip filter module. But it will not work0 _) }# k, i: L; c8 S( i# N
with proxy compressed response. You can disable the compressed response
! f+ W8 s, C2 T  Z* {$ F like this:
2 ~( ~; N8 n4 I: l/ c
6 F2 P7 v$ K7 y9 a* Y" \  O: Jproxy_set_header Accept-Encoding “”;

5 v# h% K5 V9 d) q) Q$ _( p+ G$ t" O# e/ s9 V
好吧,原来是没指定替换类型,默认只替换html) }0 v3 v5 [2 R* P
% D/ Q6 f6 j2 u3 B; n, P* h" z- }
在nginx站点配置中加入下面代码:6 d) B2 [! H, `

& ^1 I/ f* B- ]( X+ f- _4 o$ Z% e subs_filter_types text/css text/xml application/xhtml+xml application/xml;" f& [: Y1 s$ D- Z, R3 ?9 a' O

4 `$ Q( k7 J, j# P+ [ 重启nginx就解决了
! u' @2 H( @: P, m" e$ K1 {
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-6-7 07:24 , Processed in 0.066788 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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