Preconnect to Required Origins
You should use “preconnect” or “dns-prefetch” hints to establish required connections to external origins as soon as possible.
This means, you’re letting your browser know that your website is going to use resources from other domains later on.
While using “preconnect” is the main suggestion because it runs the DNS lookup (getting the IP from the domain name) and any possible redirection there might be, you can also use “dns-prefetch”.
In this case, “dns-prefetch” is a great fallback because it’s supported by more browsers than “preconnect”, even if it only handles the DNS lookup.
How WP Rocket can help
WP Rocket adds preconnect automatically in these cases:
- WP Rocket’s Optimize Google Fonts feature adds “preconnect” to the fonts.gstatic.com domain to improve Google fonts loading time.
- The CNAME entered on the CDN tab
For additional third party domains used on your site, you can add them to the Prefetch DNS Requests box on the Preload tab in WP Rocket.
You can find the listed domains in your PageSpeed report by clicking on this Opportunity, as shown here:
This way, WP Rocket will add the “dns-prefetch” resource hint to perform an early DNS lookup to important third-party, as it’s requested.
When adding the domains, you shouldn’t use the protocol HTTP/HTTPS but only the forward slashes “//”, like this:
Add all the listed domains, one per line, and that would be it!
You can find more information about Preconnect here.