Allow setting crossOrigin="use-credentials" for static files served from another domain / CDN (buildAssetsDir/cdnUrl)
#30.003 aperta il 21 nov 2024
Metriche repository
- Star
- (60.221 star)
- Metriche merge PR
- (Merge medio 3g 7h) (114 PR mergiate in 30 g)
Descrizione
Describe the feature
Currently, there is no way to set different crossorigin value than "" (anonymous) for static files. This becomes a problem when JS static files are served from CDN and we need to pass cookies in order to work properly in certain conditions - for example when Cloudflare Under Attack Mode is being on.
As a workaround, we created Nitro plugin which uses render:html hook. In that hook we have to parse html head and manually replace crossOrigin value.
I believe there should be an option (nuxt.config?) alongside buildAssetsDir and cdnUrl that could faciliate implementation, especially in large-scale projects.
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.