简体   繁体   中英

IIS rewrite rule

I have a site defined in IIS as "mysite_dot_com"

I have two applications defined under it as follows: "/myapp" and "/sec/myapp"

"mysite_dot_com/myapp" is our main application URL and servicing all http requests by passing to a downstream server. Under a failure a condition, "/myapp" will return a response with status code "503/Service Unavailable".

I need help to capture this event ( ie 503 event), using outbound rule and rewrite the URL as "7.5 mysite_dot_com/sec/myapp". (no worry on "/sec" part, it can be trimmed before passing to my downstream server).

Alternative suggestions are most welcome.

Thanks a lot.

-Ram

On IIS 8.5 you could accomplish this by going into IIS > Error Pages

In there you would be able to add the 503 event, and then have it execute the absolute URL of the site you would want to send them to on the event.

So if they visit "mysite.com/myapp", and they would trigger a "503/Service Unavailable" error, IIS would route them to the absolute URL that you had used when defining how the webserver should handle a 503 event, by sending them to "mysite.com/sec/myapp".

There is probably a way you could use an Outbound rule for this as well, but I'm not sure of a way you would make it react off of Status Code, unless you added a custom Server Variable.

Here is a list of available Server Variables.
https://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM