找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16755|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。  h; w# x1 y6 F  L4 R6 }
3 Q4 A0 Y6 Q  X$ l% [) i! A
一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)* E! M6 B/ h- C& j3 @& `/ Q
7 e, n4 g! V; y" M6 @# z' p, W
打开ngx_http_substitutions_filter_module的github看到:
; t) Q/ P! |: |0 {5 A# X$ Q
' M0 m" ?2 {  Q' ]
subs_filter_types) e4 ?+ x( E( [% _% u1 ~
syntax: *subs_filter_types mime-type [mime-types] *7 T. L+ P: E" Y5 N+ R% _

+ }% j! p5 s7 Y4 Hdefault: *subs_filter_types text/html*# B8 `- Z6 T0 Y! E2 u6 r

; w: z# ~- w9 p! s- |context: *http, server, location*
" I! }1 f! P0 H6 \  M  F
) Y: q" [* U: [( m3 \; _# m*subs_filter_types* is used to specify which content types should be
# [* k9 d7 m: I+ y9 H checked for *subs_filter*. The default is only *text/html*.
! M, w& s) @/ F7 y& ?& W$ j! F- s& R- X2 S6 U
This module just works with plain text. If the response is compressed,0 S0 K1 A5 B7 B0 z1 Z
it can’t uncompress the response and will ignore this response. This
+ E0 H6 K0 K, {' p% L! x module can be compatible with gzip filter module. But it will not work
* [3 |2 B( @+ a6 s3 d, c with proxy compressed response. You can disable the compressed response
; ?% i& ]6 l% D1 O0 R; z5 J8 o like this:
3 j- L6 p$ P( ]# j+ k0 z' ^, @+ g+ m' v. B+ N; {6 s
proxy_set_header Accept-Encoding “”;
( O3 O* z  k. ?$ r0 @
+ G/ c7 i' |6 u9 H) q3 K7 X. S
好吧,原来是没指定替换类型,默认只替换html
( D0 q+ g; X- P- |- ~; L$ l: L& n! F7 c% }
在nginx站点配置中加入下面代码:3 q  t. i) o& c# Z5 U

6 p# O& R" U& f$ N8 t) J: N subs_filter_types text/css text/xml application/xhtml+xml application/xml;
$ _( c! i- W; |9 ]; e* ?
* ~0 p/ p. S& j9 K" U( U 重启nginx就解决了, B% g7 G6 s8 W3 o8 ], O% v
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-12-4 01:36 , Processed in 0.071767 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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