TL;DR Cloudflare's compression will strip comments out of html and break Twig debugging.

This is a true story of being a developer:

For the better part of the day I’ve been trying t track down why twig debug wasn't working on one of my dev environments.. Now, generally speaking, turning on twig debugging is simple: Change a flag in your services.yml, clear your Drupal cache, and rock and roll.  I’ve done this 100’s of times, so, why today isn’t this working?

I start to think about it, the only thing non-traditional about the way I handle this is that I have a separate services.yml set up for my dev environment ( and test  for what environment I'm in in settings.php and load the appropriate services file.  This has worked for years but just to be sure, I use drush to tell me the status of the debug flag and it's fine


So I. know the right services file is loading.  I check multiple browsers, make sure the comments are turned on in the browsers' page source tool.  I make sure Drupal caching is turned off.  I start googling, and am getting no where.  Spent some time spinning down rabbit holes, disabling browser plugins, reading Drupal Core source and really got no where.  I stepped away, went for a walk.  Sat down to work on something else and then....

It Hit Me!  Last week, I was debugging a problem which required me to turn on Cloydflare's caching against this environment, something I never do. Cloudfare's HTML compression was also turned on which stripped out the comments, so debug messages weren't being seen.So I  flipped Cloudflare to DNSonly for this sub-domain, wait 15 mins for DNS to propagate, cleared Drupal cache, and it  worked.  It's always the simple things.

Laptop w/ Stickers