
Access to from origin ‘null‘ has been blocked by CORS policy: No ‘Access
Access to XMLHttpRequest at 'localhost:8080/postgres/mvt/source/834/428/10' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看其它成功的请求,发现需要给response header加上这个
response.addHeader("access-control-allow-origin", "*"); @Log @RestController @RequestMapping("my") public class MyController { private Connection connection; @RequestMapping(value = "source/{x}/{y}/{z}",produces = MediaType.IMAGE_PNG_VALUE) public byte[] st_AsMvt(@PathVariable("x") Integer x, @PathVariable("y") Integer y, @PathVariable("z") Integer z,HttpServletResponse response) throws Exception { /*...*/ response.addHeader("access-control-allow-origin", "*"); return bytes; } }👁️ 阅读量:0
© 版权声明:本文《Access to from origin ‘null‘ has been blocked by CORS policy: No ‘Access》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686958028a408322.html。