支持CORS跨域请求

This commit is contained in:
RuoYi
2020-07-22 15:25:42 +08:00
parent 133a10ecf2
commit 1e40e60dbf
3 changed files with 37 additions and 0 deletions

View File

@ -178,6 +178,8 @@ public class GenController extends BaseController
private void genCode(HttpServletResponse response, byte[] data) throws IOException
{
response.reset();
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setContentType("application/octet-stream; charset=UTF-8");