diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index 9b36eea..24aef54 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -251,6 +251,8 @@ public class FileServiceImpl extends AbstractService implements IFileService { * @param contentLength */ private void setRangeHeader(long startRange, long endRange, HttpServletResponse response, String fileId, long contentLength) { + // 这里不设置,会出现第一次加载很慢的情况 + response.setHeader("Content-Length", String.valueOf(contentLength - startRange)); response.setHeader("Content-Range", String.format("bytes %d-%d/%d", startRange, endRange, contentLength)); response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Etag", fileId);