webpack-dev-server配置跨域

devServer: {
        port: 8088,
        historyApiFallback: {
            index: '/dist/index.html'
        },
        proxy: {
            '/upload/license': {
                target: 'http://shop.xxx.xyz',
                changeOrigin: true
            },
            
        }
    },
Access to XMLHttpRequest at 'http://shop.xxx.xyz/upload/license' from origin 'http://localhost:8088' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

请求的时候跨域,在webpack-dev-server中配置了 但是还是提示跨域, 这是为啥?

阅读 3.5k
1 个回答

请求url多加了个域名,已解决

推荐问题