Apache 2.4托管angular不发送所有请求



我在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));
}));
}

似乎当它被部署到apache时,Angular或apache(不确定哪个)会在for循环中杀死其他未来的请求。同样,这在本地适用于NG Serve,但在Apache中不能正常工作。我们确实在Apache中安装了MPM,但只是基本配置。

原循环中的返回是导致问题的原因。我把返回移到循环之外,它解决了这个问题。

最新更新