I've created a small module to do this, but it might make sense to fold this in.

https://github.com/mshmsh5000/admin_menu_path

Our use case: Many of our sites are served via Akamai. If a user with admin perms is the first to view a URL in Akamai, then that page has the admin menu cached in its output. Of course we can hide this with CSS, but I still don't want the output in HTML.

The display logic is the standard block-style path handler.

Comments

sun’s picture

Status: Active » Closed (won't fix)
Issue tags: -display

Your configuration/logic for caching pages is wrong then. If the cached page shouldn't contain the admin menu, then you should not cache pages generated for privileged users that have access to admin menu.

mshmsh5000’s picture

I take it you're saying that we should supply contextual cache-control headers that can send No-Store for users with certain permissions. That's fine, except when your CDN is set up to ignore cache-control headers. In that situation, which I can tell you exists in the real world, you need this functionality. The answer isn't always to change the CDN config, because there may be other (overriding) reasons why that config needs to stay as-is.