简体   繁体   English

使用 CLI 在 IBM Cloud Object 存储桶中配置 CORS

[英]Configure CORS in IBM Cloud Object Storage Bucket using CLI

I am trying to configure CORS in my IBM Cloud Object Storage bucket.我正在尝试在我的 IBM Cloud Object 存储桶中配置 CORS。 I dont see any option to do that from bucket configuration in UI and I can see it can only be done through CLI.我在 UI 中的存储桶配置中看不到任何选项,我可以看到它只能通过 CLI 完成。 The command looks similar to how its done in AWS CLI as well.该命令看起来也类似于它在 AWS CLI 中的完成方式。 This is the command to configure CORS,这是配置 CORS 的命令,

ibmcloud cos bucket-cors-put --bucket BUCKET_NAME [--cors-configuration STRUCTURE] [--region REGION] [--output FORMAT]

It is expecting cors configuration STRUCTURE in JSON format from a file and add it as --cors-configuration file://<filename.json> .它期望从文件中以 JSON 格式的 cors 配置结构 STRUCTURE 并将其添加为--cors-configuration file://<filename.json> I have created a configuration file as cors.json and saved it on my Desktop.我创建了一个配置文件 cors.json 并将其保存在我的桌面上。 But when I am providing path for that file and running the command, I am getting this error, The value in flag '--cors-configuration' is invalid但是当我为该文件提供路径并运行命令时,我收到此错误,标志“--cors-configuration”中的值无效

I am providing file path like this - --cors-configuration file:///C:/Users/KirtiJha/Desktop/cors.json我提供这样的文件路径 - --cors-configuration file:///C:/Users/KirtiJha/Desktop/cors.json

I am new with Cloud CLI.我是 Cloud CLI 的新手。 Am I doing wrong here?我在这里做错了吗? Any help is much appreciated任何帮助深表感谢

You can configure CORS in the CLI or via API and SDKs .您可以在 CLI 中或通过 API 和 SDK配置 CORS 。 On the CLI, you can use the IBM Cloud COS plugin in the bucket-cors-put command as you mentioned.在 CLI 上,您可以在您提到的bucket-cors-put 命令中使用 IBM Cloud COS 插件。

The file URI seems valid to me.文件 URI 对我来说似乎有效。 You could try to set it in quotes ("file:///...").您可以尝试将其设置在引号中(“file:///...”)。 Also, try to copy the file into your current directory and then test with --cors-configuration file://cors.json .另外,尝试将文件复制到当前目录,然后使用--cors-configuration file://cors.json进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用CLI为IBM Cloud Object Storage创建HMAC凭证? - How do I create HMAC credentials for IBM Cloud Object Storage using the CLI? 如何使用aws-cli访问Google Cloud Storage存储桶 - How to access Google Cloud Storage bucket using aws-cli 使用 IBM Cloud Object 存储 CLI 以及在我的 Java 程序中列出对象时,我收到 TLS 握手错误 - When listing of objects using the IBM Cloud Object Storage CLI, and also in my Java program, I get a TLS handshake error 快照 IBM Cloud Object Storage - Snapshot IBM Cloud Object Storage 如何使用 Node.js 上传图片到 IBM Cloud object 存储(COS)? - How to upload an image to IBM Cloud object storage (COS) using Node.js? IBM 云存储与 PHP - IBM cloud storage with PHP 直接从 IBM COS(云对象存储)流式传输? - Streaming directly from IBM COS (Cloud Object Storage)? 有用于IBM云对象存储(IBM COS)的Java SDK吗?在哪里可以找到一些示例? - Are there any for java sdks for IBM cloud object storage (IBM COS), and where can I find some examples? 使用 object 存储桶进行视频流式传输 - Video streaming with object storage bucket Rails ActiveStorage 的 Google Cloud Storage CORS 问题 - Google Cloud Storage CORS issue with Rails ActiveStorage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM