Problem/Motivation
When using the minify html module in combination with the Advanced Varnish module
https://www.drupal.org/project/adv_varnish →
, the ESI implementation is broken because of the minify html module.
Steps to reproduce
Enable both modules and then enable the minify html and strip comments functionality.
When the output is passed through Varnish using ESI, the minification is gone from the output.
This is because the only allowed reponse classes are:
- Drupal\big_pipe\Render\BigPipeResponse
- Drupal\Core\Render\HtmlResponse
The Advanced Varnish module uses "Drupal\adv_varnish\Response\ESIResponse".
Next to that, the output of an ESI tag is provided as
<!--esi <esi:include src="..." maxwait="..."/> -->
When stripping comments, we lose this whole section and varnish cannot find the ESI tag anymore. This last one seems like an issue with the module, as it shouldn't need the comment tags, I will report that one there, but keep it here as a reference for people encountering the same issue.
Proposed resolution
To resolve the minification issue it seems that we need to allow to add additional reponse types into the array. I will create a patch to add this specific one right now, but a structural solution needs to be provided to avoid having other contrib modules specific code inside the module.
Remaining tasks
Analyse the best solution, go for a config screen, settings override, hook solution, ... ?