locked
App_offline.htm should return a Connection: close header RRS feed

  • Question

  • User-383274733 posted

    Hi, I have been experimenting a bit with this feature and wanted to use this for loadbalancing purposes, but realized that it still uses keep-alive connections even though the response is a 503.

    I'm not sure if there is a reason behind this, but in the scenario where one is using a load-balancing proxy, such features might "stick" a visitor to a certain server until the keep-alive connection is killed, which would work against the principle of a failover cluster.

    In comparision, a web-site that has been shut down manually, will start returning a 404, with a connection: close header to efficiently kill the current persistent connection, and a retry would shuffle the visitor to another server.

    Some load-balancing systems do send a RESET packet to all active connections on a node, but this isn't necessarily an option.

    According to this dialog: https://issues.apache.org/bugzilla/show_bug.cgi?id=56555

    Both Tomcat and Apache httpd enforces a connection: close header for 503 responses. IIS even does this if it hits the connection limit configured.

    I tried adding it manually using rewrite rules, but to no avail.

    Monday, June 9, 2014 11:13 AM

All replies

  • User-2064283741 posted

    Not tested this or used the app_offline method for a downpage but where are the 503s being returned? IIS or the Http.sys?

    Monday, June 9, 2014 12:37 PM
  • User-383274733 posted

    Sorry for the late response, just found this thread when searching for this issue again.

    Seems like it is part of the ASP.NET pipeline. Weird because the application pool will be "off", but the functionality seems to be part of this method:

    System.Web.HttpRuntime.CheckApplicationEnabled()

    Checking the decompiled source indicates that it throws a HttpException:

    throw new HttpException(503, string.Empty);

    Not sure what would be responsible for setting a Connection: Close, but with a 503 response, it seems logical that a connection: close should be desired (similar to how it's handled for a 404).

    Wednesday, November 5, 2014 8:04 AM