Skip to content

mod_redirect模块里可以使用res_code_in的条件语句吗,因为使用req_path_prefix_in可以重定向,但使用res_code_in不行? #1024

Discussion options

You must be logged in to vote

@zhhOceanfly 不可以。

因为这样的用法不对,BFE重定向模块在执行时,请求并未转发给后端。此时与响应相关的条件原语均返回false

如果真实需求是:当后端返回的响应满足某种条件(例如5xx错误),对响应进行修改替换为自定义的响应(例如改为302响应),
可以使用mod_errors 模块对将响应进行修改替换为自定义的响应。

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@iyangsj
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mileszhang2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants