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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

I disabled dev mode and things are now fine on localhost:3000.

The culprit was:

 devServer: {
    host: '0.0.0.0'
  },

本文标签: