Model/ResponsePlugin.php
public function aroundSetHeader(Http $subject, callable $proceed, ...$args) // @codingStandardsIgnoreLine - unused parameter
    {
        // Is Fastly cache enabled?
        if ($this->config->getType() !== Config::FASTLY) {
            return $proceed(...$args);
        }

        // Is current header X-Magento-Tags
        if (isset($args[0]) == true && $args[0] !== 'X-Magento-Tags') {
            return $proceed(...$args);
        }

        // Make the necessary adjustment
        $args[1] = $this->cacheTags->convertCacheTags(str_replace(',', ' ', $args[1]));
        $tagsSize = $this->config->getXMagentoTagsSize();
        if (strlen($args[1]) > $tagsSize) {
            $trimmedArgs = substr($args[1], 0, $tagsSize);
            $args[1] = substr($trimmedArgs, 0, strrpos($trimmedArgs, ' ', -1));
        }

        // Proceed
        return $proceed(...$args);
    }
public function aroundSetHeader(Http $subject, callable $proceed, ...$args) // @codingStandardsIgnoreLine - unused parameter
    {
        // Is Fastly cache enabled?
        if ($this->config->getType() !== Config::FASTLY) {
            return $proceed(...$args);
        }

        // Is current header X-Magento-Tags
        if (isset($args[0]) == true && $args[0] !== 'X-Magento-Tags') {
            return $proceed(...$args);
        }

        // Make the necessary adjustment
        $args[1] = $this->cacheTags->convertCacheTags(str_replace(',', ' ', $args[1]));
        $tagsSize = $this->config->getXMagentoTagsSize();
        if (strlen($args[1]) > $tagsSize) {
            $trimmedArgs = substr($args[1], 0, $tagsSize);
            $args[1] = substr($trimmedArgs, 0, strrpos($trimmedArgs, ' ', -1));
        }

        // Proceed
        return $proceed(...$args);
    }
Alter the X-Magento-Tags header

@param Http $subject
@param callable $proceed
@param array ...$args
@return mixed