0048-00000202

问题描述

通过OSS默认公网域名访问BucketMIME类型(即响应头中Content-Type)为application/vnd.android.package-archive或者application/iphone的文件,服务器返回400错误。

问题原因

出于安全考虑,自2024080500:00:00起,针对该日期之后创建的Bucket,通过OSS默认公网域名以文件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-cn-hangzhou.aliyuncs.com/test-file
* About to connect() to test-demo.oss-cn-hangzhou.aliyuncs.com port 80 (#0)
*   Trying 127.0.0.1...
* Connected to test-demo.oss-cn-hangzhou.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-cn-hangzhou.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-00000202
<
<?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-cn-hangzhou.aliyuncs.com</HostId>
  <EC>0048-00000202</EC>
  <RecommendDoc>https://help.aliyun.com/zh/oss/support/0048-00000202</RecommendDoc>;
</Error>

解决方案

使用自定义域名访问上述文件不会被阻断。具体操作,请参见绑定自定义域名至Bucket默认域名