Apache 2.4部署Angular应用分片上传仅首个请求成功问题排查
Angular分片上传功能部署Apache HTTPD 2.4后仅第一个分片请求正常问题
我在Apache HTTPD 2.4上部署了一个Angular应用,目前正在开发分片上传功能,可在用户使用应用的过程中后台发送文件分片。
该功能在本地使用ng serve运行时完全正常,但部署到Linux的httpd环境后,仅第一个分片请求能正常发送,后续请求就停止处理,所有网络请求返回的状态码均为200。
相关代码
接收大文件分片数组的异步方法
async postLargePart(data: any, update_query: any): Promise<any> { // Variables const proj_id = data[0].filter.id; // Run update for everything but the large file first await this.query.post(this.createFormData(update_query)).toPromise(); // post the big file in chunks for (const dataIdx in data) { if (data.hasOwnProperty(dataIdx)) { try { // get all the current files to append to each big query // Need to do this here so that if multiple large files are // in the array, it will append the last large file to the next const result = await this.query.post({ action: 'SELECT', values: [ 'id' ] }).toPromise(); // loop through other files that were posted and append them to the query data[dataIdx]['object']['file_set'].push(...result); return await this.query.post(this.createFormData(data[dataIdx])).toPromise(); } catch { console.log('Error'); return null; } } }
方法调用代码
... // Split out large and small queries return from(this.splitLargeFiles(obj, id).then(result => { // store the objects const large_file_queries = result.large_file_queries; const obj2 = result.obj; // Create the query for the smaller files/no files const update_query = { 'action': 'UPDATE', 'object': (this.serializeDQE(obj2)), 'filter': { 'id': id } }; // Post the large data return from(this.postLargePart(large_file_queries, update_query)); })); }
现有排查信息
暂未定位到是Angular还是Apache导致的异常,当前使用的Apache已安装MPM模块,仅使用基础配置。
内容的提问来源于stack exchange,提问作者Neumsy
相关产品推荐
相关产品推荐

