Want to take a look at our new docs? Our new docs are now in beta. Have fun!

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' : '/'
      }
    }
}

Contributors

Contribution for this page is now closed. If you would like to contribute please check out our new docs are now in beta. Have fun!

Platinum Sponsors

Storyblok Support Us