Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preconnect/dns-prefetch resource hint against web.dev best practices #489

Open
schlessera opened this issue Nov 30, 2020 · 2 comments
Open
Labels

Comments

@schlessera
Copy link

I think this combined preconnect and dns-prefetch resource hint is not always doing what it is supposed to do depending on the browser:

html.Attribute{Key: "rel", Val: "dns-prefetch preconnect"})

As far as I can tell, the dns-prefetch is meant to be the fallback in case the preconnect is not supported (as the preconnect would include a DNS resolution). However, the dns-prefetch is mentioned first, which seems odd.

Also, according to web.dev, best practice is to use two separate hints with the dns-prefetch as the second hint serving as a fallback, as using a combined hint will break in Safari:
https://web.dev/preconnect-and-dns-prefetch/#resolve-domain-name-early-with-reldns-prefetch

@schlessera
Copy link
Author

Related issue in Node.JS optimizer: ampproject/amp-toolbox#960

@twifkak
Copy link
Member

twifkak commented Feb 18, 2021

Sorry I missed this. For reference, in Google this was originally added in http://cl/239478133 per http://b/118606783.

Since you landed a fix on the optimizer, I think it makes sense to do the same here, and it seems safe to do so.

@twifkak twifkak added the fixit label Feb 18, 2021
@twifkak twifkak added this to the v3: b3 + local transforms milestone Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants