Skip to main content

CdnPreconnect

The preconnect resource hint is a useful way of making sure connections to external domains are ready as soon as possible. It can improve performance by enabling the browser to start downloading critical assets right after discovering them in the HTML.

Because every Shopify store makes use of cdn.shopify.com, the platform already includes the preconnect resource hint inside the Link header in the main document response. This makes the preconnect in the HTML redundant.

Because CDN assets are served from the main store domain, it's even more unnecessary, as there might be no assets coming from cdn.shopify.com at all. In this case, the redundant preconnect can negatively impact performance.


The following examples contain code snippets that either fail or pass this check.

<link href="https://cdn.shopify.com" rel="preconnect" />
<link href="https://cdn.shopify.com" rel="preconnect" crossorigin />

<link href="https://example.com/" rel="preconnect" />
<link href="https://example.com/" rel="preconnect" crossorigin />

The following example contains the default configuration for this check:

CdnPreconnect:
enabled: true
severity: warning
ParameterDescription
enabledWhether the check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended because preconnect to Shopify's CDN is in the best case redundant and in the worst case negatively impacts performance.



Was this page helpful?