环境:前端vue、nginx windows端1.61.1
报错:前端通过element 文件上传控件,点击上传文件,浏览器报错:
Access to XMLHttpRequest at ‘http://localhost:6100/vidservice/vod/upload’ from origin ‘http://localhost:9529’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
后端controller上已经加了@CrossOrigin注解,而且其他controller同样使用此注解,并没有出现跨域问题:
@RestController
@RequestMapping("/vidservice/vod")
@CrossOrigin
查了教学视频发现nginx中需要设