DXA has a nice feature which caches labels, settings and mapping information on disk when it first loads up. This increases performance of model mapping and commonly used resources. These are published by the Publish Settings Page in SDL Web/Tridion.
However, when these resources change, DXA doesn’t know about them due to the lack of caching invalidation between the Content Delivery, the deployer and Content Service.
To mitigate this, DXA provides us with a HTTP end point to clear this cache which is at /admin/refresh. Requesting this in a browser or script clears the cache.
But there’s a couple of problems with this:
- It’s not really a good idea to have the URL /admin/refresh open to the internet since it clears the cache and could be abused in a Denial of Service attack.
- What happens in Production when you have more than one web server behind a load balancer?
The solution for these two problems we came up with was to block /admin/ at the load balancer level (redirecting to the homepage of the site). Then on each web server we added a scheduled task which runs the following Powershell every hour.
Invoke-WebRequest -Uri 'http://www.mydxasite.com/admin/refresh'
We added a hostname to each server to point the domain at the local server rather than going out to the internet and meaning we didn’t have to update Topology Manager.
This means that the servers all get updated at pretty much the same time and we don’t have to remote desktop to 3 machines whenever we change a resource or a setting.
Let me know what you think.
P.S. Sorry about the diagrams, just trying out a new WordPress plugin.