Simulating HTTP errors in Sitecore

Ensuring the reliability and robustness of a Sitecore instance is critical for providing a good user experience.

This is where the Monitoring comes in.

Monitoring your Sitecore website is very important as any failure will be detected quickly and we ensure that the visitor is not harmed.

One aspect of this is monitoring for HTTP errors, such as 403, 404, 500 and, 504.

The idea of this post is not to show you how to resolve these errors or which monitoring tool is good but to provide simple and quick ways to simulate these errors without using a 3°-party tool.

Let’s explore how we can simulate these errors within a Sitecore XP/XM environment.

A 500 error typically indicates an internal issue with the server that hosts the Sitecore instance, which usually is the Content Delivery server. Simulating this error allows us to test how well our monitoring systems detect and respond to such issues.

One method to simulate a 500 error is by introducing a fault into the server environment. This could be done just removing a simple and critical DLL, such as the Sitecore.Kernel.dll.

This is one of the most important DLL for Sitecore and it isn’t able to work withou it. So go to the Server, then go to the webroot folder and remove it from the /bin folder and you should see a error like that:

Once the error is simulated, take a look at your monitor’s response.

A 504 error, also known as Gateway Timeout, occurs when a server does not receive a timely response. In other words, the page takes time to load and it reaches the timeout.

A simple option to test it is just shutting down the IIS for your website, so go to the IIS and Stop the website:

And you should see an error like this:

This one occurs when the server doesn’t have proper access to the website folder. To simulate it, change the Physical Path of the site to a folder that you know the server doesn’t have access to.

The following error is expected:

This is a famous one and you definitely don’t want your visitor come to your website and see this error. The 404 error occurs when a requested resource is not found on the server.

A simple idea for simulating it is just changing the default port of the site. Go to Bindings > Port and change it to a random one, such as 81.

Which results in this famous screen:

Leave a Reply

Your email address will not be published. Required fields are marked *