问题描述
通过传输加速域名访问Bucket中MIME类型(即响应头中Content-Type)为application/vnd.android.package-archive
或者application/iphone
的文件,服务器返回400错误。
问题原因
出于安全考虑,自2024年08月05日00:00:00起,针对该日期之后开通传输加速的Bucket,通过OSS传输加速域名(bucketname.oss-accelerate.aliyuncs.com
或bucketname.oss-accelerate-overseas.aliyuncs.com
),以文件URL或者匿名请求的形式访问MIME类型(即响应头中Content-Type)为application/vnd.android.package-archive
或者application/iphone
的文件时,请求被阻断。服务器返回400错误,错误码为ApkDownloadForbidden
。
问题示例
使用OSS传输加速域名访问MIME类型(即响应头中Content-Type)为application/vnd.android.package-archive
的文件时,响应如下:
curl -v http://test-demo.oss-accelerate.aliyuncs.com/test-file
* About to connect() to test-demo.oss-accelerate.aliyuncs.com port 80 (#0)
* Trying 127.0.0.1...
* Connected to test-demo.oss-accelerate.aliyuncs.com (127.0.0.1) port 80 (#0)
> GET /test-file HTTP/1.1
> User-Agent: curl/7.29.0
> Host: test-demo.oss-accelerate.aliyuncs.com
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: AliyunOSS
< Date: Wed, 05 Jun 2024 09:44:52 GMT
< Content-Type: application/xml
< Content-Length: 450
< Connection: keep-alive
< x-oss-request-id: 66603394A9D9AEAD99000223
< Accept-Ranges: bytes
< ETag: "A28BCA1B906F539BA70CA3A0B1F2E773"
< Last-Modified: Wed, 05 Jun 2024 08:25:31 GMT
< x-oss-object-type: Normal
< x-oss-hash-crc64ecma: 1026653970686684427
< x-oss-storage-class: Standard
< x-oss-server-time: 209
< x-oss-ec: 0048-00000203
<
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>ApkDownloadForbidden</Code>
<Message>The APK file is not allowed to be distributed in a public network using the OSS endpoint, please use CNAME instead.</Message>
<RequestId>66603394A9D9AEAD99000223</RequestId>
<HostId>test-demo.oss-accelerate.aliyuncs.com</HostId>
<EC>0048-00000203</EC>
<RecommendDoc>https://help.aliyun.com/zh/oss/support/0048-00000203</RecommendDoc>;
</Error>
解决方案
使用自定义域名访问上述文件不会被阻断。具体操作,请参见绑定自定义域名至Bucket默认域名。
文档内容是否对您有帮助?