CDN module 4.x: no new features + drop BC layers + drop now irrelevant headers + PHP >=8.1 + Drupal >=9.4
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3103682. -->
Reported by: [wim leers](https://www.drupal.org/user/99777)
>>>
<p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/cdn/-/work_items/3071814" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/cdn/-/work_items/3071814</a></span> added Drupal 9 compatibility. We don't need a new major version for that.</p>
<p>But over time a few pieces of backwards compatibility layers were added. Plus, the browser landscape changed. Finally, core infrastructure improvements would allow this module to become simpler.</p>
<dl>
<dt>Browser landscape</dt>
<dd>✅ <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/cdn/-/work_items/3100868" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/cdn/-/work_items/3100868</a></span>
<dd>✅ <code>preconnect</code> vs <code>dns-prefetch</code>: <code>@todo Remove when http://caniuse.com/link-rel-preconnect has support in all browsers or is equivalent with http://caniuse.com/#feat=link-rel-dns-prefetch</code><br>
</dd>
</dd><dt>BC layers</dt>
<dd>✅ <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/cdn/-/work_items/2870435" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/cdn/-/work_items/2870435</a></span> expanded the capabilities of the CDN module, but required BC layers in <code>\Drupal\cdn\CdnFarfutureController</code>, <code>\Drupal\cdn\PathProcessor\CdnFarfuturePathProcessor</code> and <code>cdn.routing.yml</code>.
<dd>✅ <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/cdn/issues/3228162" title="Status: Closed (fixed)">#3228162: Fix Drupal 9-only deprecation notices while retaining Drupal 8 compatibility</a></span> added a BC layer to remain compatible with Drupal 8 while fixing Drupal 10 deprecations.</dd>
<dd>✅ <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/cdn/issues/3194164" title="Status: Closed (fixed)">#3194164: Harden against invalid calls to file_create_url(): avoid TypeError in CDN module's code execution</a></span> added a warning that is obsolete once sites are on Drupal 9.3, because core will be just as strict as the CDN module. We should remove that gracefully warning logging.</dd>
<dd>✅ <em>Evidently we can also remove the <code>8.x-3.x</code> <code>hook_update_N()</code> update hooks plus the associated tests.</em><br>
</dd>
</dd><dt>PHP landscape</dt>
<dd>✅ Require PHP 8.1 since Drupal 10 <a href="https://www.drupal.org/docs/system-requirements/php-requirements">will require it</a> (up from 8.0 since <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/drupal/issues/3264819" title="Status: Closed (fixed)">#3264819: Require PHP 8.1 for Drupal 10.0.0-alpha2</a></span>) and active support for PHP 7.4 will end at the end of 2021. (Version 3 of the CDN module will have been around for 5 years, I'd rather make version 4 be supportable for the next 5 years.)</dd>
<dd>✅ Start using PHP 8-only features, or features that were only available in later PHP 7 versions. For example: return type hints, union types would both help make this module behave more reliably.</dd>
<dd>✅ Start using PHP 8.1-only features: <a href="https://www.php.net/releases/8.1/en.php">https://www.php.net/releases/8.1/en.php</a>.</dd>
<dt>Core infrastructure improvements</dt>
<dd>✅ <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/drupal/issues/2669074" title="Status: Closed (fixed)">#2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it</a></span></dd>
<dd>✅ <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/drupal/issues/3021803" title="Status: Closed (fixed)">#3021803: Document and add tests for service autowiring</a></span></dd>
<dt>Core infrastructure changes</dt>
<dd>❌ <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/cdn/issues/3216302" title="Status: Closed (fixed)">#3216302: Remove Tour support</a></span></dd>
<dd>✅ Fix deprecation: <code>Parameter $event of method Drupal​\​cdn​\​EventSubscriber​\​HtmlResponseSubscriber::onRespond() has typehint with deprecated class Symfony​\​Component​\​HttpKernel​\​Event​\​FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead</code></dd>
</dl>
> Related issue: [Issue #3071814](https://www.drupal.org/node/3071814)
> Related issue: [Issue #2681459](https://www.drupal.org/node/2681459)
> Related issue: [Issue #2669074](https://www.drupal.org/node/2669074)
> Related issue: [Issue #3049525](https://www.drupal.org/node/3049525)
issue