本地react项目请求springboot后台报跨域错误的问题?

为什么前端代码里已经配置了跨域请求的时候还报跨域错误

module.exports = {
  dev: {
    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    // for local debug only 需要时再配置proxyTable
    proxyTable: {
      '/admin/': {
        target: 'http://localhost:8080',
        changeOrigin: true
      },
      '/dev-basp-user/': {
        target: 'http://localhost:8080',
        changeOrigin: true
      },
      '/dev-basp-system/': {
        target: 'http://localhost:8080',
        changeOrigin: true
      },
      '/coupon/': {
        target: 'http://localhost:8080',
        changeOrigin: true
      }
    },

1.png

阅读 1.6k
1 个回答

需要后台也配置下接受这个域才行。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题