在IIS重写规则中,是否可以返回带有URL的CustomResponse statusCode? [英] In IIS rewrite rules, is it possible to return a CustomResponse statusCode with a URL?

查看:94
本文介绍了在IIS重写规则中,是否可以返回带有URL的CustomResponse statusCode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在为某些网站(例如a.b.com,b.b.com和c.b.com)计划一个维护窗口.我们想做的是为位于我们主站点(由Tridion CMS数据库提供支持)(例如,www.b.com/maintenance.html)上的保留页面返回503返回码,因为该站点不是正在进行维护.有可能吗?

We are planning a maintenance window for some of our sites (say at a.b.com, b.b.com and c.b.com). What we would like to do is to return a 503 return code for a holding page sitting on our main site (which is powered by a Tridion CMS database) (say at www.b.com/maintenance.html) as that site is not undergoing maintenance. Is that possible?

我们知道您可以在每个正在维护的应用程序的根目录中创建一个app_offline.htm文件,但这将要求我们为每个应用程序构建一个维护页面,而不仅仅是在我们页面上添加一些内容.主站点,然后通过我们的CMS发布该内容.然后,可以在我们的负载均衡器中为正在对保留页面进行维护的域创建重定向.

We know you can create an app_offline.htm file in the root of each of the applications undergoing maintenance, but that would require us to build a maintenance page for each application, rather than just to add some content to a page on our main site and publish that content out through our CMS. A redirect could then be created in our load balancer for the domains undergoing maintenance to the holding page.

推荐答案

是.您可以创建CustomResponse操作类型.这是用于创建自定义响应代码的文档: https://technet.microsoft.com/en-us/library/ee215207(v = ws.10).aspx

Yes. You can create a CustomResponse action type. Here is the documentation for creating custom response codes: https://technet.microsoft.com/en-us/library/ee215207(v=ws.10).aspx

<rule name="My custom response">
    <match url="^my_url_regex_pattern$"/>
    <action type="CustomResponse" statusCode="503" statusReason="Undergoing Maintenance" />
</rule>

这篇关于在IIS重写规则中,是否可以返回带有URL的CustomResponse statusCode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆