0
0

More than 1 year has passed since last update.

CORS設定

Last updated at Posted at 2021-12-01

全体像

サーバーとフロントの両方で設定を行う
開発環境では

  // if (process.env.NODE_ENV === 'production') {

とコメントアウトする

フロント

modules

nuxt.config.js
  modules: [
    '@nuxtjs/axios',
        // 追加
    '@nuxtjs/proxy',
  ],

  axios: {
        //追加
    proxy: true,
    // baseURL: 'http://localhost:3000/display/get-info-commitment'
  },

  proxy: {
    '/display/': {
        target: 'http://localhost:3000',
        changeOrigin: true,
        secure: false
    }
  },

サーバー


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0