3

I have a staging site that has the isSystemOn set to false since I don't want people to stumble upon the site and be able to view content. I would like to have 1 page still "visible" though. This URL would a simple health check page, that I direct a monitoring service to check on. I'm stumped at overriding a system level isSystemOn config setting.

Can I have staging.example.com/my-secret-health-check-url return a valid code of 200 so my monitoring service can correctly see that my staging site is working?

2 Answers 2

6

I realized there is a simpler solution after stepping away from this issue for a bit. There is one page that still returns a 200 code on a Craft site even when the isSystemOn (or isSystemLive as of Craft 3.1) is false. Using the control panel login page as a health check url is the solution.

2

Just have that page not be in the CMS. Create something like web/ping.html and point the monitoring service at that static file.

If you want it to work anyway, you could have an offline.html template, and you could change the status code that it returns... but that would be a little weird.

It was changed to isSystemLive btw... more info here: Handling Errors Gracefully in Craft CMS

2
  • A static file wouldn't work well as a health check. We also use /admin/login as a health check as you have more assurance that PHP and Craft are well. Commented Mar 29, 2019 at 2:37
  • Makes sense, it's true that a static file will only tell you that the server and webserver are up and working, not that PHP and Craft are well. Commented Mar 30, 2019 at 1:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.