Quantcast
Viewing all articles
Browse latest Browse all 25

Sitecore Patchable Ignore Lists

Sitecore hijacks requests as they comes through the application via the httpRequestBegin pipeline. In order to serve a resource outside of the Sitecore pipeline, you need to abandon the Sitecore context. Sitecore achieves this by allowing you to add the route to ignore to the IgnoreUrlPrefixes setting. This blog post shows a way to support patchable ignore paths so you don’t need to copy the existing setting to add to it.

Let’s think of a quick example of the concern: you want to ignore the Sitecore pipeline for requests to /foo, /bar, and /baz. The way I would have done this before was to patch the Sitecore setting with a copy of the old one and added my new route(s) at the end, roughly like so:

So instead, I’ve created a new pipeline processor that comes after the built-in one (which will support the existing native IgnoreUrlPrefixes setting) and will allow you to add each path via its own XML config node. The advantage here is you can patch and continue to patch on without needing to copy the existing values. Here’s the final patch config to load my new processor with two sample paths to ignore:

So not only will the original list of paths be ignored, now we’ve added /foo and /bar to the list.

Here’ an example on another patch patching in a third value to ignore:

Here’s the source code for the processor:

Marketplace Module & Source

This is now available on the Sitecore Marketplace as a module.

Additionally, the source code is on GitHub.

Update: in the process of putting this on the Marketplace I found out that Ben Golden has a similar solution with the exact same name Image may be NSFW.
Clik here to view.
🙂

Sitecore Patchable Ignore Lists is a post from Fire Breaks Ice, published by Mark Ursino, Sitecore Technology MVP


Viewing all articles
Browse latest Browse all 25

Trending Articles