go-drive
go-drive copied to clipboard
S3 无法上传文件
我绑定了一个桶,可以正常下载,删除,重命名文件 在 Go-drive 内可以新建文件和文件夹,但是上传文件就会提示错误
是 AWS S3 吗?是否勾选 上传代理
?
是甲骨文,他家是可以直连的,我尝试勾选上传代理也是同样的问题。
我现在还没办法测试甲骨文的,可否提供一些上传失败时出现的错误信息。
比如浏览器控制台中的信息,或者服务端的日志信息。
Access to XMLHttpRequest at 'https://example.compat.objectstorage.ap-tokyo-1.oraclecloud.com/z/desktop.ini?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=example%2F20230222%2Fap-tokyo-1%2Fs3%2Faws4_request&X-Amz-Date=20230222T103903Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=example' from origin 'https://godrive.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
index.a9c53c86.js:44
PUT https://example.compat.objectstorage.ap-tokyo-1.oraclecloud.com/z/desktop.ini?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=example%2F20230222%2Fap-tokyo-1%2Fs3%2Faws4_request&X-Amz-Date=20230222T103903Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=example net::ERR_FAILED
docker logs godrive
2023/02/22 10:38:30 Creating drive: Local
2023/02/22 10:38:30 Created drive: Local
2023/02/22 10:38:30 Creating drive: JP251
2023/02/22 10:38:31 Created drive: JP251
2023/02/22 10:38:31 Creating drive: OD_E5
2023/02/22 10:38:31 Created drive: OD_E5
2023/02/22 10:38:31 Creating drive: Gdrive
2023/02/22 10:38:31 Created drive: Gdrive
2023/02/22 10:38:31 Creating drive: JP201
2023/02/22 10:38:31 Created drive: JP201
2023/02/22 10:38:31 Creating drive: jp_s3
2023/02/22 10:38:35 Created drive: jp_s3
2023/02/22 10:38:35 Creating drive: teracloud
2023/02/22 10:38:35 Created drive: teracloud
2023/02/22 10:38:35 Reloading drives done.
2023/02/22 10:38:35 [i18n] 2 languages loaded: [en-US zh-CN]
2023/02/22 10:38:35 [i18n] default language: zh-CN
2023/02/22 10:38:35 Server started
[GIN] 2023/02/22 - 10:39:03 | 200 | 31.514952ms | 172.26.0.1 | POST "/upload/jp_s3/desktop.ini?size=282"
Access to XMLHttpRequest at 'https://example.compat.objectstorage.ap-tokyo-1.oraclecloud.com/z/desktop.ini?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=example%2F20230222%2Fap-tokyo-1%2Fs3%2Faws4_request&X-Amz-Date=20230222T103903Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=example' from origin 'https://godrive.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. index.a9c53c86.js:44 PUT https://example.compat.objectstorage.ap-tokyo-1.oraclecloud.com/z/desktop.ini?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=example%2F20230222%2Fap-tokyo-1%2Fs3%2Faws4_request&X-Amz-Date=20230222T103903Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=example net::ERR_FAILED
docker logs godrive 2023/02/22 10:38:30 Creating drive: Local 2023/02/22 10:38:30 Created drive: Local 2023/02/22 10:38:30 Creating drive: JP251 2023/02/22 10:38:31 Created drive: JP251 2023/02/22 10:38:31 Creating drive: OD_E5 2023/02/22 10:38:31 Created drive: OD_E5 2023/02/22 10:38:31 Creating drive: Gdrive 2023/02/22 10:38:31 Created drive: Gdrive 2023/02/22 10:38:31 Creating drive: JP201 2023/02/22 10:38:31 Created drive: JP201 2023/02/22 10:38:31 Creating drive: jp_s3 2023/02/22 10:38:35 Created drive: jp_s3 2023/02/22 10:38:35 Creating drive: teracloud 2023/02/22 10:38:35 Created drive: teracloud 2023/02/22 10:38:35 Reloading drives done. 2023/02/22 10:38:35 [i18n] 2 languages loaded: [en-US zh-CN] 2023/02/22 10:38:35 [i18n] default language: zh-CN 2023/02/22 10:38:35 Server started [GIN] 2023/02/22 - 10:39:03 | 200 | 31.514952ms | 172.26.0.1 | POST "/upload/jp_s3/desktop.ini?size=282"
看样子是有跨域的问题,需要配置一下,可以参考 https://go-drive.top/#s3 配置一下
https://www.oracle.com/cloud/storage/object-storage/faq/
The Oracle Cloud Infrastructure Object Storage API and Swift API do return Cross-Origin Resource Sharing (CORS) headers; however, the returned headers are fixed and cannot be edited. The Amazon S3 Compatibility API does not return CORS headers.
这就没办法了,我看看后面支持一下这个。