unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

fix(prerender): skip protocol relative links #2661

Closed danielroe closed 1 month ago

danielroe commented 1 month ago

๐Ÿ”— Linked issue

resolves https://github.com/nuxt/nuxt/issues/28525

โ“ Type of change

๐Ÿ“š Description

Came across this reported in nuxt. If a protocol relative URL is present in the HTML, for example:

<link rel="preload" as="fetch" crossorigin="anonymous" href="//xxx.cqyx.vip/statidsdfc/_payload.json?f0e0efd8-19ce-4c52-9ba9-77accf60864b">

Then /static will be crawled. We check for protocol but not for protocol relative URLs. I think checking for host should be sufficient as /static would not have a defined host but let me know if you have a better idea.

๐Ÿ“ Checklist