The app_offline.htm file that ASP.NET serves returns the http status 503. This is the correct behavior for most situations. However, in the scenario where a specific URL is requested (e.g. https://www.mywebsite.com/monitor), I'd like to change the returned http status to 200, while still returning http status 503 in all other situations. Is this possible?
The reason why I want to do this is whenever we do scheduled maintenance on our website, we use the app_offline.htm file, but we don't want our uptime monitoring service (Pingdom.com) to report downtime during our scheduled maintenance.
I assume this would have to be at the IIS level because the app_offline.htm gets served very early on in the request processing cycle.
Note that App_Offline
is only there to take the ASP.NET part down, it has nothing to do with the IIS site. All non-ASP.NET request -like .htm- will go through the normal IIS pipeline.
That being said, a HTTP 503
is an unavailable service error. The App_Offline.htm
take the site partially offline, it is normal and correct that all ASP.NET request get a 503
response when the site is offline.
Bypass this with a HttpModule or whatever code in the ASP.NET pipeline is not a valid solution.
Since you'are already creating/copying the App_Offline.htm
in your IIS root during maintenance, I'll suggest to add maintenance.htm
as a default document for your /monitor
folder or your IIS site and create/copy a maintenance.htm
file in it during maintenance : then the default page will be reach whatever the ASP.NET site is offline or not.
If your probe is calling the http://servername/monitor/
uri without any page specified, it will work.
You just have to delete it -like you delete your App_Offline
- after the maintenance.
As far as I know, the app_offline.htm logic is handled inside the ASP.NET 2.0 module but before any application loading begins (which is of course the idea behind app_offline.htm *g*).
I suggest:
monitor
to the root of your (disabled) Website and assign it to some IIS-readable folder.app_offline.htm
file renamed to default.htm
(or whatever is in your default filename list) into that folder.This way IIS should serve the html file with a 200 response when accessing https://www.mywebsite.com/monitor
.
Ah, and to honor Adilson's warning about search engines, just add a <meta name="robots" content="noindex">
to your file in case the website is reachable by search engines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With