Home > Guardian Error Handling System > Help > 1012

Error count not incremented on IIS during redirects

When using Microsoft Internet Information Server with an "http-redirect" Filter Rule, the ErrorCount variable will not be incremented each time the error occurs. This is because the ErrorCount is stored in a session cookie, and IIS has a bug in which cookies are sometimes not set during an HTTP redirect.

To work around this bug, you can use a "redirect" Filter Rule instead on an "http-redirect" one.

Or, you can configure Guardian to operate in non-parsed-headers mode. To do this:

  1. Rename "ag.pl" (or "ag.cgi") to "nph-ag.pl" (or "nph-ag.cgi").

  2. Update your IIS error-handler settings to point to the new file name.

  3. In "nph-ag.pl", set $const{'PRINT_HTTP_STATUS_HEADER'} = 1;

    This variable is only available in Guardian version and newer.

Together, these three changes will cause IIS to not parse the headers returned by Guardian, thereby bypassing the IIS bug which causes Set-Cookie headers to be stripped. See this Microsoft KB article for more information.

Note that, in some cases, some browsers choose to not accept Set-Cookie response headers on an HTTP redirect, even if the web server can be made to respond with such a header. In those cases, using a "redirect" Filter Rule instead on an "http-redirect" one is the best solution.

Thanks to Brian Renken for identifying the problem and supplying this workaround.

    "Error count not incremented on IIS during redirects"