找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15331|回复: 0

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

[复制链接]
发表于 2013-6-2 19:06:53 | 显示全部楼层 |阅读模式
反代了一个论坛,输入账号密码登录后,会跳转回原来的站。用了subs_filter也一样。, W) @+ p4 C; [" }9 _

( P  a) C: [% D; E+ h一直在苦恼这个问题,经某人点拨,Discuz跳转的文件是xml后缀的(详情哪个文件我也不知道….)
; f# O3 r7 C( n$ S) f& J: D0 h6 h, l+ G2 M
打开ngx_http_substitutions_filter_module的github看到:8 I! H5 ~7 p% _! _6 L' A- f) K2 e1 f

# V) o& g( T' [( r( K
subs_filter_types
2 Y/ i" E2 s# t* D8 g syntax: *subs_filter_types mime-type [mime-types] *# y: f' [$ H2 P0 ?; R3 [
6 V( _# B: d: f0 Z" S" v
default: *subs_filter_types text/html*2 {/ D" ~" ~8 D- e

/ _, z9 l* o- [7 ]3 N9 fcontext: *http, server, location*5 `" [, H0 U# ^. R: f) \
. a2 F. R! H5 O* [0 c9 |- D
*subs_filter_types* is used to specify which content types should be
* Y  a. e0 J! X. W" s& k: s. ^3 S checked for *subs_filter*. The default is only *text/html*.! P0 ^0 T" v3 Q) b; m3 b6 L
, u5 b* G# V( K& v# m7 n
This module just works with plain text. If the response is compressed,
7 r( V' [" L, M- K3 p2 U it can’t uncompress the response and will ignore this response. This
. B# h' o8 K- k5 q3 ~+ v6 ?  f! u$ q module can be compatible with gzip filter module. But it will not work6 K2 r. A0 R( D: q
with proxy compressed response. You can disable the compressed response
7 V5 h$ }: K% h! F like this:  ?0 {+ R6 j' G$ B, p+ ^; |! X3 R
$ o1 [* a- u( M# U9 [* ]
proxy_set_header Accept-Encoding “”;

. j* h1 ]* d8 r/ U$ F1 r# `( f
好吧,原来是没指定替换类型,默认只替换html1 n$ M% j( y; h# K/ `6 ?, \

- K0 P% c3 }6 G8 T' U在nginx站点配置中加入下面代码:
- r/ f6 p- L5 \- w& Z$ i
; ~( W* q  @1 B* k% E% d subs_filter_types text/css text/xml application/xhtml+xml application/xml;+ g% ~+ c: Q0 V/ j( u9 W

  F! j1 F) C1 j+ A6 N4 x 重启nginx就解决了* }# C# o, H! T9 _
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-6-16 10:52 , Processed in 0.053908 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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