Java后端代码解决前端访问跨域问题

代码中添加如下代码片段:

LOG.info("Cross-domain issues");
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers",
        "Origin, X-CSRF-TOKEN, X-Requested-With, Content-Type, Accept");






你可能感兴趣的:(Java,Web,Server)