admin管理员组文章数量:1398831
I am loading three Google fonts from Google. I am using '@nuxt/fonts' module in Nuxt 3. In dev console for both Firefox and Chrome I get this error:
A preload for 'http://192.168.1.129:3000/_fonts/xMQOuFFYT72X5wkB_18qmnndmSdSnn-J-Vq1ibuGSdi.woff' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.
I have the current setup for Google fonts in my nuxt.config.ts
:
modules: [
// For brevity I have removed other modules I use when posting this here on SO
'@nuxt/fonts',
],
fonts: {
provider: 'google'
},
//@ts-ignore
security: {
headers: {
crossOriginEmbedderPolicy: 'unsafe-none',
crossOriginOpenerPolicy: 'unsafe-none',
contentSecurityPolicy: {
'font-src': [''], // <--- add the domain you want to fetch the image from here
}
},
},
I have tried changing CORS policy but to no avail, error still there.
Now I also get:
GET http://192.168.1.129:3000/_fonts/wlptgwvFAVdoq2_F94zlCfv0bz1WCzsW_LM-Y7xrszA4ZH.woff
net::ERR_ABORTED 404 (Server Error)
Albeit all fonts are loading in dev mode when testing on local. I am loading fonts from Google with '@nuxt/fonts',
Thing is this started happening when I added a new page and routed that dynamically.
I am loading three Google fonts from Google. I am using '@nuxt/fonts' module in Nuxt 3. In dev console for both Firefox and Chrome I get this error:
A preload for 'http://192.168.1.129:3000/_fonts/xMQOuFFYT72X5wkB_18qmnndmSdSnn-J-Vq1ibuGSdi.woff' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.
I have the current setup for Google fonts in my nuxt.config.ts
:
modules: [
// For brevity I have removed other modules I use when posting this here on SO
'@nuxt/fonts',
],
fonts: {
provider: 'google'
},
//@ts-ignore
security: {
headers: {
crossOriginEmbedderPolicy: 'unsafe-none',
crossOriginOpenerPolicy: 'unsafe-none',
contentSecurityPolicy: {
'font-src': ['https://google'], // <--- add the domain you want to fetch the image from here
}
},
},
I have tried changing CORS policy but to no avail, error still there.
Now I also get:
GET http://192.168.1.129:3000/_fonts/wlptgwvFAVdoq2_F94zlCfv0bz1WCzsW_LM-Y7xrszA4ZH.woff
net::ERR_ABORTED 404 (Server Error)
Albeit all fonts are loading in dev mode when testing on local. I am loading fonts from Google with '@nuxt/fonts',
Thing is this started happening when I added a new page and routed that dynamically.
Share Improve this question edited 2 days ago jonrsharpe 122k30 gold badges268 silver badges475 bronze badges asked Mar 26 at 21:48 Thomas James ThorstenssonThomas James Thorstensson 3092 silver badges14 bronze badges1 Answer
Reset to default 0I disabled dev mode and things are now fine on localhost:3000.
The culprit was:
devServer: {
host: '0.0.0.0'
},
本文标签:
版权声明:本文标题:nuxt.js - Request credentials error in dev console (Firefox & Chrome) when loading Google Font using '@nuxtfonts 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744124306a2591884.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论