问题
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?
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.
回答1:
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>
来源:https://stackoverflow.com/questions/42114236/in-iis-rewrite-rules-is-it-possible-to-return-a-customresponse-statuscode-with