have you solved it? I have also encountered this situation
'Access-Control-Allow-Origin':' *'
it is useless to set the foreground in the background, but it will turn the request into a non-simple request
.
Cross-domain file upload is actually a cross-domain request. If you are a project generated by vue-cli, under the config file, find index.js, to configure cross-domain configuration. For example:
proxyTable: {
'/api': {
target: '',
changeOrigin: true,
pathRewrite: {
'^/api': '',
},
}
},
when requesting, add / api/ your interface name in front of all interfaces to achieve cross-domain.
it's no use setting headers at the front end. You can either set ``Access-Control-Allow-Origin':'*'
on the backend, or set the proxy in the proxyTable in config/index.js. Of course, setting the proxy is only useful for development.
setting the proxy is also useless. Why?