The code to detect the CMS (taken from the subsites module) currently starts by getting a local config variable for admin paths. This config option doesn't exist in our code, so it's redundant. We just check the url_base in the admin controller.
When determining whether a request is in the CMS, the middleware currently reads the AdminRootController.url_base config value directly.
If the admin URL has been changed via Director rules, but the url_base option in AdminRootController hasn't also been set, the getIsAdmin() function will end up with the wrong URL.
AdminRootController::admin_url() is available which checks the Director rules before falling back to the config option. Would this be a better method of checking the admin routes?
When a page is still in concept the cdn cannot pull the images yet. So when you view the page in stage mode you miss the images as the url's are already rewritten to the cdn url.