0048-00000300

问题描述

通过OSS默认公网域名触发预设的重定向(3xx跳转)规则时,服务器返回400错误。

问题原因

出于安全考虑,自2024080500:00:00起,针对该日期之后创建的Bucket,通过OSS默认公网域名以文件URL或者匿名请求的方式访问OSS文件时,触发了Bucket预设的重定向(3xx跳转)规则,请求被阻断。服务器返回400错误,错误码为ExternalRedirectForbidden

问题示例

假设Bucket配置了以下重定向规则:

image

当访问Bucket内不存在的文件时,按照重定向规则跳转响应如下:

curl -v http://test-demo.oss-cn-hangzhou.aliyuncs.com/not-exist-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 /not-exist-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:57:36 GMT
< Content-Type: application/xml
< Content-Length: 435
< Connection: keep-alive
< x-oss-request-id: 66603690A9D9AE14A2000036
< Location: http://www.test.com/not-exist-file
< x-oss-server-time: 105
< x-oss-ec: 0048-00000300
<
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>ExternalRedirectForbidden</Code>
  <Message>3xx redirect to public network is not allowed using the OSS endpoint, please use CNAME instead.</Message>
  <RequestId>66603690A9D9AE14A2000036</RequestId>
  <HostId>test-demo.oss-cn-hangzhou.aliyuncs.com</HostId>
  <EC>0048-00000300</EC>
  <RecommendDoc>https://help.aliyun.com/zh/oss/support/0048-00000300</RecommendDoc>;
</Error>

解决方案

使用自定义域名请求触发重定向将不会被阻断。具体操作,请参见绑定自定义域名至Bucket默认域名