目前AWS API Gateway在使用proxy+时无法正确处理路径参数,需要通过修改Lambda函数代码来解决。在Lambda函数中使用event.pathParameters来获取路径参数,然后手动合并为完整路径。示例代码如下:
exports.handler = async (event) => {
const pathParams = event.pathParameters;
const fullPath = event.path.replace(/\/+/g, '/') + '/' + pathParams.id;
// 处理完整路径
// ...
return {/* Lambda函数返回值 */};
};