I am looking to configure error pages on SXA. I read the following topic and configured it accordingly:


I have generated a static 500 error page. I can see it is handled by Sitecore pipeline but what if something goes wrong and it can't even execute the pipeline. So I decided to add handling into IIS web.config like this:

    <httpErrors errorMode="Custom" existingResponse="Replace" >
        <clear />
        <remove statusCode="404"/>
        <remove statusCode="500" />
        <error statusCode="500" responseMode="File"
               path="500.htm" />

The problem with the above configuration is that it changes the response of the 404 as well. So now 404 starts showing IIS default pages instead of the configured page in Sitecore. Is there a way to handle 500 as a fallback from IIS without affecting the handling of 404?

  • Have you tried changing the existingResponse to "Auto" instead of "Replace"? You can also add another line for the 404 page <error statusCode="404" path="/404" responseMode="ExecuteURL" /> Commented May 31, 2021 at 9:21
  • @CristiVulturar this will actually change the response code for 404 to 200. I want to keep to the response codes intact.
    – Arun Kumar
    Commented Jun 4, 2021 at 1:52
  • How do you have the 404 page setup in your SXA? The 404 response code should be set from your 404 custom page automatically if you have Error Handling set for your SXA site. Do you have your 404 page set in the Page Not Found Link in the /{tenant/{site}/Settings item? Commented Jun 7, 2021 at 9:23
  • But than we will have to make sure that all the pages have the url of /404 and can't be configured through SXA.
    – Arun Kumar
    Commented Jun 10, 2021 at 5:57
  • You are trying to have IIS handle the 500 and SXA handle the 404 page, as static or editable in sitecore? Do you have the same page set in both Page Not Found Link and Server Error Page Link? If you take a look for example at from-sitecore-with-love.de/blog/2020/sxa-not-found-page the page set in Page Not Found Link will return a 404 http response status Commented Jun 10, 2021 at 7:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.