You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS Transfer Family AS2发送文件时MimeType错误问题排查

解决AWS Transfer Family AS2发送文件时MIME类型不正确的问题

问题原因

AWS Transfer Family AS2发起文件传输时,不会自动读取S3对象已有的Content-Type元数据,若未显式指定,会默认使用application/octet-stream作为传输的MIME类型。

解决方法

1. 通过AWS CLI指定MIME类型

修改start-file-transfer命令,添加--metadata参数显式设置Content-Type:

aws transfer start-file-transfer --connector-id c-123 --send-file-paths "/bucket/file.edifact" --metadata '{"Content-Type": "application/edifact"}'

2. 通过Java SDK指定MIME类型

在StartFileTransferRequest构建器中添加metadata配置,传入Content-Type键值对:

client.startFileTransfer(
    builder -> builder
        .connectorId(connectorId)
        .sendFilePaths(bucket + "/" + key)
        .metadata(Map.of("Content-Type", "application/edifact"))
);

验证

修改后重新发起传输,查看AS2日志中的requester-content-type字段,应显示为application/edifact。

内容的提问来源于stack exchange,提问作者lukkna

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 07:50:01