1

I have a site served using IIS, and when I am performing my periodic maintenance I put an app_offline.htm file at its root (this is necessary to indicate to google and other bots that the site should not be indexed)

However IIS randomly serves the site with a 200 OK response code instead of a steady 503.

The site has two virtual apps inside, and it doesn't help if I put additional app_offline.htm in them.

How can I prevent this from happening? I want a steady 503 response for as long as app_offline.htm is in the site root.

Site tree

Main Site
|
|---Virtual App 1
|
|---Virtual App 2

App pool parameters:

  • .NET CLR Version: v4.0.30319
  • Managed pipeline mode: Integrated

Windows Server 2019

Version 1809 (OS Build 17763.3346)

IIS

Version 10.0.17763.1

Example FRT Log

Following the comment suggestion from Lex Li, I activated failed request tracing with a trigger of status code 200, and here's a sample log file from that:

https://pastebin.com/CGR0LjQh

For comparison, here's a trace for a 503 response:

https://pastebin.com/GRfK9H56

Aviad P.
  • 103
  • 1
  • 9
  • Enable FRT and see who gives you 200, https://docs.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis and that usually tells what's wrong. – Lex Li Sep 12 '22 at 07:08
  • Ok did that, I am getting lots of logs, a log file is about 4500 lines long, what should I look for in there? Nothing seems too suspicious. – Aviad P. Sep 12 '22 at 07:23
  • I added the (sanitized) FRT log to the question (and also here: https://pastebin.com/CGR0LjQh) – Aviad P. Sep 12 '22 at 07:38
  • I also added a 503 log (after changing the trigger) https://pastebin.com/GRfK9H56 – Aviad P. Sep 12 '22 at 07:51
  • Am I missing something here, if bots are requesting the app_ofline.htm file to determine to index further, and the server is indeed returning its presence, why *would* the response not be 200 for the GET? The file does not inherently take the app offline? If the service is still there, and the original path is available, such as index.htm, whether or not the service produces a 503 would be up to the service, not the presence of the app_offline file? – Sabre Nov 02 '22 at 20:56
  • Apparently IIS serves app_offline.htm sometimes with a 200 and sometimes with a 503 - I have no idea why, and to be frank, I am not sure I care enough to know the reason. I do want a 503 response code though, to prevent robots from thinking that the maintenance page content is actual site content and then indexing it. Having said that, take a look at the FRT logs, sometimes it is a 200 and sometimes it is a 503 with no apparent reason that I could find. – Aviad P. Nov 03 '22 at 06:39
  • Ahh, got ya so the anomaly is 503 for serving the page, ok, so I was missing something. I cannot explain that.. Curious though, why would you expect the app_offline to *cause* the 503 if the app is up and the page is being requested directly? – Sabre Nov 03 '22 at 14:20
  • We want a 503 for when app_offline.htm is served. -- During our weekly maintenance time, we put the app_offline.htm (with the intention of it being returned as 503) so that crawlers will not consider the maintenance page as normal site content. – Aviad P. Nov 04 '22 at 10:18

0 Answers0