⚠️ You are looking at the english version of the page. Help us translate it here.

How to share cross-origin resource?

The solution of cross origin resource sharing in Nuxt.js

npm i @nuxtjs/proxy

In nuxt.config.js

 modules: [
      '@nuxtjs/axios',
      '@nuxtjs/proxy'
  ],
proxy: {
  '/api': {
    target: 'http://example.com',
    pathRewrite: {
      '^/api' : '/'
      }
    }
}

Platinum Sponsors

Storyblok Support Us