找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13986|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。
' I% b7 E2 i0 V7 M: |, h) {
/ r2 N9 F  O  r! {7 N0 q4 i一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
" \: R: F5 `: a
3 W% b2 O4 B+ P7 I打开ngx_http_substitutions_filter_module的github看到:0 f6 B# {) B! q! L

' J: a8 Z+ a; e- F. g$ b
subs_filter_types0 m% o( x1 I, r7 H" d- p
syntax: *subs_filter_types mime-type [mime-types] *: [" s1 ]4 |2 [  k  |6 a* f& I

  Z4 \, X& a! ~& |. Fdefault: *subs_filter_types text/html*: u* ?3 F0 ^, k6 |: L, d
" S5 ]2 M7 l9 o# }7 l* [
context: *http, server, location*! m$ ~. ]( h% F  v
0 v: Z$ g1 o, C
*subs_filter_types* is used to specify which content types should be3 a# H% b, Z$ Y% e8 Y
checked for *subs_filter*. The default is only *text/html*.
$ p1 ?( t4 `/ k  {2 z  I) I5 D/ r5 [
This module just works with plain text. If the response is compressed,
1 y4 T# Y" q" q it can’t uncompress the response and will ignore this response. This
" [+ h. Z. }/ A# A% }$ Z; b, V+ }! ` module can be compatible with gzip filter module. But it will not work" _0 ?. ^1 X# g3 b
with proxy compressed response. You can disable the compressed response
6 D$ \1 S/ r4 e4 l, | like this:+ r7 H7 h# _, O& N0 t4 @
/ g% n, I3 X8 U/ x0 }# k) A
proxy_set_header Accept-Encoding “”;
% m6 f; T: w3 z; u% @
( _' L1 l9 v0 s; F& N8 c/ U6 d9 z
好吧,原来是没指定替换类型,默认只替换html
* a: b# C- {9 P8 x! k
3 V# Z0 @; ~  w9 B# N在nginx站点配置中加入下面代码:6 A- a( i: p$ Y& S5 v% G' h# z

, s+ O7 B2 v! ]; V/ l- R7 X! u) r9 Q subs_filter_types text/css text/xml application/xhtml+xml application/xml;
  d1 p: {; s" t  y# X# q/ o' c: c6 e9 ?( {% r! D, \2 V
重启nginx就解决了! b+ `  g* I& a# G8 A! X' U9 N
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-2-4 20:10 , Processed in 0.065008 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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